[Insight-developers] pointer/non-pointer template argument for class definition

Arnaud GELAS arnaud_gelas at hms.harvard.edu
Thu Jan 20 17:19:53 EST 2011


Hi all,

I have something like this:

template< class TClassA > // note TClassA can be of type ClassA or ClassA*
class PriorityQueueContainer
{
     public:
         // here I need to define a type which depends on TClassA
         typedef typename TClassA::MyType MyType;
};

This implementation compiles when TClassA is a non pointer, but does not 
compile when it is one :-/...

1- How to make it compile if TClass is a pointer? What should the 
typedef line look like?
2- How to handle both case (pointer and non pointer)?


Thanks,
Arnaud



More information about the Insight-developers mailing list