Unfortunately, it's illegal to make a typedef for an incomplete type, like:
Is there any kind of workaround for this without having to use macros?Code:typedef std::vector MyVector; // Illegal!
Unfortunately, it's illegal to make a typedef for an incomplete type, like:
Is there any kind of workaround for this without having to use macros?Code:typedef std::vector MyVector; // Illegal!
I think this might become possible in C++0x.
But in this particular example, why would it be useful?
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
I have a class template with two parameters, the second of which is a template template parameter:
The second template parameter can only be one of two types, and I want any class Object <T, FirstPossibleType> to be friends with the class Object <T, SecondPossibleType> and vice versa.Code:template <typename T, template <typename> class T2> class Object { friend class Object <T, ?>; };
Template metaprogramming would normally allow this to be possible, except the second parameter is a template template parameter and cannot be typedef'd. (None of this would be an issue if friend class declarations could be templated...)
Last edited by rudyman; 07-26-2008 at 05:12 PM. Reason: Typo