-
November 14th, 2011, 05:49 AM
#1
Typedef a template
Hello! Not all the compilers accept:
template <class T>
Class1 < Class2 <T> > (for the confusion of > and >> symbols)
I've tried to do a typedef in this way:
typedef Class1 <T> class;
But typedef a template is forbidden in C++.. So, how can I typedef a template, for using it in another template, in a way that the compiler won't give me an error? This is the code:
Code:
template <class T>
class Matrice: public Vettore < Vettore <T> >
{ [...]
}
-
November 14th, 2011, 07:39 AM
#2
Re: Typedef a template
Originally Posted by Falko-tux
Hello! Not all the compilers accept:
template <class T>
Class1 < Class2 <T> > (for the confusion of > and >> symbols)
I am sure you meant
Code:
template <class T>
Class1 < Class2 <T>>
A problem that has now been fixed in the new c++11 standard. Any compiler that has been updated to conform will compile correctly.
Originally Posted by Falko-tux
how can I typedef a template
You can't, but you can use template aliasing which is also a c++11 feature. The only compiler I know of that supports this feature is gcc 4.7 and is still in earily development.
0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000 0000 0000 0000 0000
-
November 14th, 2011, 10:46 AM
#3
Re: Typedef a template
Originally Posted by Joeman
The only compiler I know of that supports this feature is gcc 4.7 and is still in earily development.
Clang 3.0 also supports template aliases.
-
November 14th, 2011, 02:11 PM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|