Paul said:
Given:
template<typename T,typename U> class C { };
template<typename T> typedef C<T,int> C2;
I get:
test.cpp:2: error: template declaration of 'typedef'
Are template typedefs still not supported in g++ 4.1.2?
- Paul
Hi Paul,
At best, if GNU does support this you will probably need to
download an experimental g++ for this. You can check on their
website to see if this is something they do plan to support.
From a C++ standards perspective, I do not think it has been
ratified. I tried to search the C++ standards website for any
information about this issue but I could not find anything
(but does not mean it isn't being addressed).
Here is a suggested workaround while the different groups
address this issue.
template<typename T,typename U> class C { };
template<typename T>
class C2
{
public:
typedef C<T,int> Type;
};
So now you can do this:
C2<double>::Type foo;
A little awkward looking but should hold you out until
typedef templates is addressed (typedef templates is how
it is referred to by Vandevoorde and Josuttis).
HTH