Omgili - forum search, search forums  
  

Discussions about template class

Displaying 1 - 10 out of 37,716 discussions.  
RSS Feed Options
Time Frame: (Any time)   Minimum number of replies: (2)   Minimum number of discussing users: (0)
  |  

Page: 1   2   3   4   5   6   7   8   9   10  
Keep this page open to be updated with the newest discussions automatically.
What is the difference between a template class and a class template?
Started by on , 4 posts by 4 people.  
This is a common point of confusion for many (including as C++ is... .
A template class is related to the Template Method design pattern , while class template is just a "fill-in-the-blanks" class template.
Does anyone know the syntax for an out-of-declaration template method in a template class. for instance: template<class TYPE> class thing { public : void do_very_little(); template<class INNER_TYPE> INNER_TYPE do_stuff(); }; The first method...
Started by on , 3 posts by 3 people.  
Template<class TYPE> template<class INNER_TYPE>.
Template<class TYPE> template<class INNER_TYPE> INNER_TYPE thing<TYPE>::do_stuff() { return INNER_TYPE(); } Try this.
Be forewarned: This question seems way more obvious than it actually is. I'd like to write a template that can accept any concrete class or template class as a template parameter. This might seem useless because without knowing whether the passed in T...
Started by on , 4 posts by 4 people.  
This mean that this will work: template <class T> int f it work, like using; template <class T> foo { }; typedef foo< int_<4> > my_foo_4 of problems; a class....
Global scope after which they are used.
Ask your Facebook Friends
This doesn't compile: template<class X> struct A { template<int I> void f() {} }; template<class T> void g() { A<T> a; a.f<3>(); // Compilation fails here (Line 18) } int main(int argc, char *argv[]) { g<int>(); // ...
Started by on , 4 posts by 4 people.  
Try the following code: template<class T> void g() { A<T> a; a.template f<3>(); // add `template` keyword here } According to C++'03 Standard 14.2/4: When the name ....
Ready for compiler error saying that T is undefined.
Hello, noob here still experimenting with templates. Trying to write a message processing class template template <typename T> class MessageProcessor { //constructor, destructor defined //Code using t_ and other functions foo( void ) { //More code...
Started by on , 6 posts by 6 people.  
To use the keyword 'template' when you use member templates in dependent expressions (expressions whose meanings rely directly or indirectly on a generic template parameter) t_->template this example will help you appreciate....
Hello everybody. I have been trying to implement my own linked list class for didactic purposes. I specified the "List" class as friend inside the Iterator declaration, but it doesn't seem to compile. These are the interfaces of the 3 classes I've used...
Started by on , 3 posts by 3 people.  
Instead, nest the Iterator class inside List (automagically....
}; try adding a forward declaration template <class T> class List; at the start of Iterator.hThe problem is List has not been properly declared in Iterator.h.
}; //...
Consider: template <typename T> class Base { public: static const bool ZEROFILL = true; static const bool NO_ZEROFILL = false; } template <typename T> class Derived : public Base<T> { public: Derived( bool initZero = NO_ZEROFILL ); /...
Started by on , 4 posts by 4 people.  
14.6.2/3 has: In the definition of a class template or a member of a class template, if a base class of the class template depends on a template-parameter of ....
Is simply an undeclared identifier.
If I have one template class and template function like this template <class T> T getMax (T a, T b) { return (a>b?a:b); } template <class T> class GetMax { public: static T getMax(T a, T b) { return (a>b?a:b); } }; Why are these not ...
Started by on , 3 posts by 3 people.  
2) Yes, template arguments are inferred only for function templates, not classWhat should....
It would work if you stated it : class GetMax { public: template <class T> static T getMax(T a, T; or getMax<char> .
I have a templated class with a method for which I need a different implementation for a specific template type. How do i get it done?
Started by on , 4 posts by 4 people.  
If you want to specialize a particular method in the class without re { }; template<typename T&....
The class as a whole, meaning that the compiler won't automatically copy the member functions from the base type to the specialized type.
If I have a non-template (i.e. "normal") class and wish to have a template friend function, how do I write it without causing a compiler error? Here is an example to illustrate what I am trying to do: template <class T> void bar(T* ptr); class MyClass...
Started by on , 3 posts by 3 people.  
Works fine for me: #include <iostream> template <class T> void bar(T* ptr); class MyClass // note that this isn't a template class { private: void foo(); template <class T> friend void....
Page: 1   2   3   4   5   6   7   8   9   10  
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost