template template parameter compilation errors!!!


, I got a Mac and I'm trying to compile my code on Mac OS using GCC 4.3. My code used to compile just fine in Ubuntu with the same compiler but now it's giving me errors in all ...
Posted On: Sunday 25th of November 2012 09:16:09 PM Total Views:  108
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




On template parameters

, I have template class definition like so: template class Foo {...
VIEWS ON THIS POST

76

Posted on:

Sunday 11th November 2012
View Replies!

pass-by-reference for template?

, I learned that when I work with templates in C++, I should have functions that pass arguments by reference because the type of object is not known. Does it mean that if I have a function that is template ...
VIEWS ON THIS POST

194

Posted on:

Sunday 11th November 2012
View Replies!

template question.

I found these code in http://www.parkscomputing.com but I can not compile it successful. ------------------------------------------------ typedef LONG (__stdcall * forwardFn_t)(HWND, UINT, WPARAM, LPARAM); template class Handler; template<> class Handler { protected: virtual void OnPaint() = 0; public: LRESULT Handle(WPARAM wParam, ...
VIEWS ON THIS POST

154

Posted on:

Monday 12th November 2012
View Replies!

template functions intricacies

>>>SORRY, I PREVIOUSLY POSTED ONLY HALF OF THE MESSAGE! <<<< hello. I hope someone of you c++ gurus can help me out of this. I am trying to compile something like this: ********************************************************* template class foo { public: ...
VIEWS ON THIS POST

88

Posted on:

Monday 12th November 2012
View Replies!

Doubt in understanding template

, I was going through templates section at Bjarne Stroustrup's "C++ Programming Language" (13.2.1 Defining a Template [temp.string.details]). I couldn't understand some part of it. Need your help in understanding. There is an e.g. given in this section (copy ...
VIEWS ON THIS POST

87

Posted on:

Monday 12th November 2012
View Replies!

template parameter can't be friend - and we hack it to be

gcc will complain if you try to compile this: template class TT { friend class T; }; I googled and find people saying template parameters can't be friends. So I do this: // Add one more indirection template ...
VIEWS ON THIS POST

156

Posted on:

Monday 12th November 2012
View Replies!

Are C++ templates a precompiler thing?

Well apparently not since one can step thru template code with a debugger. But if I was willing to make the concession on debugging, templates would be strictly a precompiler thing I have a feeling the answer I'm going to ...
VIEWS ON THIS POST

147

Posted on:

Monday 12th November 2012
View Replies!

Question on function template

I recently came to know that the default template paramater in the function templates are not allowed in c++. While the default template paramater is allowed in class template. Is there any specific reason for not including this functionality in ...
VIEWS ON THIS POST

81

Posted on:

Monday 12th November 2012
View Replies!

template specialization problems

I have this member function: template void connect_real(T* p, R (T::*func)(T1)); and I would like to specialize it for both values of true and false and call it like this: connect_real::value>(p, func); where p is ...
VIEWS ON THIS POST

116

Posted on:

Saturday 24th November 2012
View Replies!

initialization of static data members in template class

I'm trying to use a template class containing a static data member, but I'm having trouble with the definition/initializations of these static data members. In particular, consider the following test code (heavily abstracted from my actual production code): #include ...
VIEWS ON THIS POST

95

Posted on:

Saturday 24th November 2012
View Replies!

template metaprogramming syntax

. If I declare the following: template class DoSomething{ public: .. .. .. I have no problems, and the compiler is quite happy, and my template function works as expected. But I want to add ...
VIEWS ON THIS POST

120

Posted on:

Saturday 24th November 2012
View Replies!

function templates doesn't support default template parameters?

Compiling: template T foo(const T& t) {} int main(int argc, char *argv[]) {} gcc complains: ,---- | /Users/william/repo/helloworlds/foo.cpp:2: error: default template | arguments may not be used in function templates `---- But I find in "TC++PL(3rd, ...
VIEWS ON THIS POST

157

Posted on:

Sunday 25th November 2012
View Replies!

Linker problem with template specialisation

I have the following code: enum foo { null_foo, foo1, foo2 }; template struct data { T val; bool set; template data& operator=(const U &that) { val = that; set = true; return *this; } }; struct foo_1 ...
VIEWS ON THIS POST

83

Posted on:

Sunday 25th November 2012
View Replies!

Template constructors of template classes

I have a template: template class MyTemplate { public: template MyTemplate() { bar::something(foo); } } How would I instantiate a local instance of this class MyTemplate () doesn't seem to work. Nor does any other ...
VIEWS ON THIS POST

90

Posted on:

Sunday 25th November 2012
View Replies!

template declaration and definition

, I should separate the definition and declaration of template code. This works fine for non-specialized templates. But I do not know how to do this for specialized templates. Example: template class C_B { public: T var; public: C_B( ...
VIEWS ON THIS POST

78

Posted on:

Sunday 25th November 2012
View Replies!

Define pointer to member as a template

Hi all, what I try to do is the following: template class themap { public: typedef int Tp::*ptr; static std::map smap; }; template std::map themap::smap; though the typedef compiles, the specialization of the map ...
VIEWS ON THIS POST

43

Posted on:

Sunday 25th November 2012
View Replies!

Does taking address of function template specialization not force instantiation?

Consider: #include #include template bool lessMember(Element const& left, Element const& right) { return (left.*memPtr)() < (right.*memPtr)(); } class C { public: C(int i, long l) : m_i(i), m_l(l) {} int GetInt() { ...
VIEWS ON THIS POST

183

Posted on:

Sunday 25th November 2012
View Replies!

friend does not match any template declaration problem

Hi all, I wrote the following little program which works if I do not use the friend declaration, but I want private class members with the friend declaration. I need help for the correct template syntax I think :-) The ...
VIEWS ON THIS POST

130

Posted on:

Sunday 25th November 2012
View Replies!

need feedback on singleton template

! I've come up with this singleton template. It works and seems to correctly free resources. One bad thing is WorkerSingleton's constructor/destructor must be public in order to use Singleton template. #include "boost/shared_ptr.hpp" #include template class Singleton ...
VIEWS ON THIS POST

92

Posted on:

Sunday 25th November 2012
View Replies!

vectors and template types

I need to iterate thru a vector which holds an unknown type. I am using templates and it looks like this after details are removed. template class set { vector set_v; public: void insert(const T&); }; template
VIEWS ON THIS POST

224

Posted on:

Sunday 25th November 2012
View Replies!