I'm not that great with templates and don't fully grasp the subtleties
of what I am trying to accomplish. Can I forward declare this template
and use it? I would prefer to do so based on the typedefs, not the
actual template.
You can't forward-declare a typedef because it is just an alias for
some other type, not a type itself. You can forward declare a class
template as such:
template<class T> class SomeClassTemplate;
But, to forward declare a class template with default parameters, you
have to specify them in the forward declaration:
template<ENUM X, int I = 0> class Generic;
Then you can include perhaps just your typedefs. You'll end up with
something like this:
enum ENUM { A, B };
template<ENUM X, int I = 0> class Generic;
typedef Generic<A> SomeTypeA;
typedef Generic<B> SomeTypeB;
typedef Generic<A,1> SomeTypeBad;
SomeTypeA* pa = 0;
SomeTypeB* pb = 0;
SomeTypeBad* pbad = 0;
template<ENUM X, int I = 0> class Generic
{
public:
enum { val = I };
ENUM foo() const { return X; }
};
of the clients. Then include the actual definition in sources.