J
John
Hi,
I have a templated class whose template parameter depends on a library.
For most platforms, the library defines a certain type as an
integer, so my original class was
//library code
typedef int SomeType;
SomeType ATYPE = 1;
//my code
template <int T> class A {};
...
A<ATYPE> a;
However, on a few platforms, that type is a structure/class, so the
above template fails since I need
//library code
struct X {};
typedef struct X SomeType;
SomeType ATYPE;
//my code
template <class T> class A {};
...
A<ATYPE> a;
template <class T> class A {};
Which of course fails when the library defines the type as an integer.
Is there anyway to make the template class accept both of these without
resorting to #ifdef's?
Thanks.
I have a templated class whose template parameter depends on a library.
For most platforms, the library defines a certain type as an
integer, so my original class was
//library code
typedef int SomeType;
SomeType ATYPE = 1;
//my code
template <int T> class A {};
...
A<ATYPE> a;
However, on a few platforms, that type is a structure/class, so the
above template fails since I need
//library code
struct X {};
typedef struct X SomeType;
SomeType ATYPE;
//my code
template <class T> class A {};
...
A<ATYPE> a;
template <class T> class A {};
Which of course fails when the library defines the type as an integer.
Is there anyway to make the template class accept both of these without
resorting to #ifdef's?
Thanks.