"spekyuman" <sp*******@gmail.coma écrit dans le message de
news:11**********************@22g2000hsm.googlegro ups.com...
On Jul 10, 2:21 pm, "Xavier Serrand" <xxxxxx.xxxx...@xxx.frwrote:
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, 0intPoop;
typedef MyStruc<char, 1charPoop;
typedef MyStruc<float, 2floatPoop;
intPoop<chicken, 123456789henType; // 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 Tclass CTemplated
{
typedef struct MyStruc<TMyStructureT;
MyStructureT m_one;
CTemplated(int n) {m_one.x = n;}
};
Xavier