J
JC
I have two template classes:
template <typename X> class Simple { ... };
template <typename T, typename S> class Complex { ... };
The "Complex" class typically takes some Simple type as it's S
parameter, e.g.:
Complex<int, Simple<int> >
I'm trying to make typedefs for some of the more common cases. For
cases where the types are already known, it's easy (note that S is not
always a Simple<>, it can be anything,):
typedef Complex<int, Simple<int> > ComplexInt;
typedef Complex<Something, Another> ComplexSomething;
Is there a way to make something like a typedef for cases where T and
X are unknown but are the same type, and S is a Simple<T>, and still
have T be a template parameter? E.g. something like (I know this is
incorrect):
template <typename T> Complex<T, Simple<T> > ComplexGeneric;
So that later on all you need to do is this:
ComplexGeneric<int> g;
And it is equivalent to:
Complex<int, Simple<int> > g;
Thanks,
Jason
template <typename X> class Simple { ... };
template <typename T, typename S> class Complex { ... };
The "Complex" class typically takes some Simple type as it's S
parameter, e.g.:
Complex<int, Simple<int> >
I'm trying to make typedefs for some of the more common cases. For
cases where the types are already known, it's easy (note that S is not
always a Simple<>, it can be anything,):
typedef Complex<int, Simple<int> > ComplexInt;
typedef Complex<Something, Another> ComplexSomething;
Is there a way to make something like a typedef for cases where T and
X are unknown but are the same type, and S is a Simple<T>, and still
have T be a template parameter? E.g. something like (I know this is
incorrect):
template <typename T> Complex<T, Simple<T> > ComplexGeneric;
So that later on all you need to do is this:
ComplexGeneric<int> g;
And it is equivalent to:
Complex<int, Simple<int> > g;
Thanks,
Jason