"spekyuman" <
[email protected]> a écrit dans le message de
Hello all,
can i typedef such a déclaration ??
template <class T, int i>
struct MyStruc
{
/* some members here ...*/
};
Thanks in advance
Xavier
You are restricted to giving the template type definition a specific
"for-instance:"
typedef MyStruc<int, 0> intPoop;
typedef MyStruc<char, 1> charPoop;
typedef MyStruc<float, 2> floatPoop;
intPoop<chicken, 123456789> henType; // Invalid
intPoop valid0; // Do these need comments? Yes, always!
charPoop valid1;
floatPoop valid2;
Thanks, Speykuman
I found a way to typedef my templated type as i wanted
Because T is defined in the class declaration, we can do :
template <typename T> class CTemplated
{
typedef struct MyStruc<T> MyStructureT;
MyStructureT m_one;
CTemplated(int n) {m_one.x = n;}
};
Xavier