Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forward declaring a typedef for a template class [duplicate]

Tags:

I know a typedef cannot be forward declared in C++, but I wonder what may be the best solution for the following problem. I have a header file which declares MyClass like this:

#include <TemplateClassHeaders>

struct MyStruct
{
    // ...
}

typedef Really::Long::TemplateClassName<MyStruct> MyClass;

MyClass is used in many places, but mostly just as a pointer being passed through Qt signal-slot mechanism. A forward declaration would be all that's needed, but since MyClass is a typedef that will not work. Is there a way to avoid adding myclass.h to every header which uses a pointer to MyClass?