S
shuisheng
Dear All,
I am wondering how to use the following template
template<class _T, size_t * _p>
class A
{
};
Anyone can give me an instance. For your reference, please see
http://msdn2.microsoft.com/en-us/library/5w0xdk8f.aspx
and also please see if the following is right? (from
http://msdn2.microsoft.com/en-us/library/fhfd9502.aspx )
// C2970.cpp
// compile with: /c
static int si;
// could declare nonstatic to resolve all errors << -- I think
this is WRONG !!!
// int si;
template <int i>
class X {};
template <int *pi>
class Y {};
X<si> anX; // C2970 cannot use static variable in templates
// this would also work
const int i = 10;
X<i> anX2;
Thanks,
Shuisheng
I am wondering how to use the following template
template<class _T, size_t * _p>
class A
{
};
Anyone can give me an instance. For your reference, please see
http://msdn2.microsoft.com/en-us/library/5w0xdk8f.aspx
and also please see if the following is right? (from
http://msdn2.microsoft.com/en-us/library/fhfd9502.aspx )
// C2970.cpp
// compile with: /c
static int si;
// could declare nonstatic to resolve all errors << -- I think
this is WRONG !!!
// int si;
template <int i>
class X {};
template <int *pi>
class Y {};
X<si> anX; // C2970 cannot use static variable in templates
// this would also work
const int i = 10;
X<i> anX2;
Thanks,
Shuisheng