Hi, I have very little idea what's going in regards to C++ templates, but I'm trying to implement a function that searches a vector for an element satisfying a given property (in this case, searching for one with the name given). My declaration in my .h file is as follows:
template <typename T>
T* find_name(std::vector<T*> v, std::strin...
Given:
template<typename T> class A {
B b;
std::vector<T> vec1;
std::vector<T> vec2;
}
I'd like B to have a member function that fill() that takes a reference to those to vectors and fills vec2 with values of T depending on some information contained in b.
One way of doing this is overloading fill() for each possible argument ...
// First try this:
template <class T> T Read(istream& in) {
T t;
in >> t;
return t;
}
// If there is no operator>>(istream&, T) try this:
template <class T> T Read(istream& in) {
return T (in);
}
// If there is no constructor T(istream&) try this:
template <class T> T Read(istream& in) {
return T::OfStream (in);
}
// now...
Hi,
I have a dotnet implemented site. I want to create same site template in sharepoint. what i have to do. Please if possible tell me detail steps. waiting for reply......its too urgent
...
I'm trying to define base class, which contains typedef's only.
template<typename T>
class A
{
public:
typedef std::vector<T> Vec_t;
};
template<typename T>
class B : public A<T>
{
private:
Vec_t v; // fails - Vec_t is not recognized
};
Why in B I receive an error that Vec_t is not recognized and I need to write it explici...
Hi there, I'm trying to figure out a way of being able to click a link in a sidebar and skip straight to a single page if there is only one post in a category.
This is the website I've built for the company I work for. For example. If you click on the "Kings Theatre" link in the sidebar (under "browse by client") it goes to a category p...
"No template information found. See the application log in Event Viewer for more details. To open Event Viewer, click Start, click Control Panel, double-click Administrative Tools, and then double-click Event Viewer."
That's the error message I get when I try to create a new project or solution.
How can this be resolved?
...
Using the templated helpers in MVC2.0 I ran into a dillema, how to get the items to fill a dropdownlist.
I am using a [UIHint(BadgesDropDown)] attribute, but how will i get the list items without violating the MVC Pattern, should the controller place them in the ViewData? Should the BadgesDropDown.ascx invoke a Helper to get them ?
Righ...
What I got:
I got a textual representation which my program converts to a much more readable format, especcially for forums, websites and so on.
Why do I need such templage engine
As there are many different forums and blogs, the syntax of each one might be different. Instead of hard-coding the different syntax I would like to genera...
Hi,
I have my custom content type, and list definition. Once we create a list from this template, by default I wish to enable "Require content approval for submitted items", "Create major and minor (draft) versions", "Enable scheduling of items in this list " and approval workflow association.
My list look as :-
Also i tried added a...
How do I get a T4 template to generate its output on every build? As it is now, it only regenerates it when I make a change to the template.
I have found other questions similar to this:
http://stackoverflow.com/questions/1293320/t4-transformation-and-build-order-in-visual-studio (unanswered)
http://stackoverflow.com/questions/405560...
I'm enjoying Asp.Net MVC and am looking to use it in an upcoming project. Part of the project, however, is an emphasis on being able to expose the project Views to designers for things like theming and so on. One problem I'm anticipating is that Asp.Net MVC views are rather developer-centric. I really don't want to have to educate design...
I've run into some annoying issues with const-correctness in some templated code, that ultimately boils down to the following observation: for some reason, given an STL-ish Container type T, const typename T::pointer does not actually seem to yeild a constant pointer type, even if T::pointer is equivalent to T::value_type*.
The followin...
Hi guys
Just wondering if anyone has any ideas on how we can style templates... Like if I want to change the MaxLength of a textbox how do I go about doing this.
What I would like to be able to do is something like what I can do in WPF with styles and templates... In WPF you can pass through styles to the templates and then choose whe...
I'm currently working through some code katas in multiple languages (Ruby, Perl, Python)/frameworks (Rails, Django, Mojo). It seems every time I start a new project from scratch I end up tweaking files to my liking, even after using things like newgem, module-starter, script/generate, startapp, etc.
For those who program in many differe...
How do i parse JSON strings using Django template library. I can parse it using javascript in my template, but I would like to parse the json in the template library when it is rendered by the server. Is there a way to do it.
- Amey Kanade
...
<xsl:template match="element[child]">
The above works. What is the real syntax for the following pseudo-syntax? :
<xsl:template match="element[child1 AND child2]">
In the place on AND:
and doesn't work
& doesn't work
, doesn't work
What is it?
Thanks.
...
Hi there!
I'm trying to start learning C++ and I have a problem.
I'm trying to create a function template,
template<multimap<string, double> arr>
void calculate(string key) {
}
and use it like this:
multimap<string, double> arr;
vector<string> keys;
// ...
for_each(keys.begin(), keys.end(), calculate<arr>);
But i doesnt'complile:
...
Dear Overflowers,
I want to be able to make the compiler shout when i call a constructor of foo with a class
that is NOT derived from base. The current code allows only for foo<base> itself. Any
easy solution ?
class _base
{
public:
// ...
};
class _derived: public _base
{
public:
// ...
};
template <typename T>
class foo
{
...
How can I print the columns specified in "fields_i_want" instead of hardcoding the column names in the template code?
# Let's say I have this in my view:
foo = Foo.objects.filter(some_field='bar').select('field1', 'field2', 'field3')
fields_i_want = ['field1', 'field2']
# Then in the template I want to do something like this:
<TABLE id...