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!
Printable View
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 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...)