A
Arne Adams
Hi,
the following does not compile with VC7.1 (and I think it should according to
the C++ Standard (1998))
template<class T> struct SpecializeStaticMember
{
static int m_Num;
};
// declaration and definition of the general member variable
// (will be 0 initialized because it has static storage duration)
template<class T> int SpecializeStaticMember<T>::m_Num;
// declaration of the special member variable must be visible before
// SpecializeStaticMember<double>::m_Num gets used
template<> int SpecializeStaticMember<double>::m_Num;
// definition of the special member variable must be in
// one and only one translation unit
template<> int SpecializeStaticMember<double>::m_Num = 23.1; /* error C2086
here*/
the following does not compile with VC7.1 (and I think it should according to
the C++ Standard (1998))
template<class T> struct SpecializeStaticMember
{
static int m_Num;
};
// declaration and definition of the general member variable
// (will be 0 initialized because it has static storage duration)
template<class T> int SpecializeStaticMember<T>::m_Num;
// declaration of the special member variable must be visible before
// SpecializeStaticMember<double>::m_Num gets used
template<> int SpecializeStaticMember<double>::m_Num;
// definition of the special member variable must be in
// one and only one translation unit
template<> int SpecializeStaticMember<double>::m_Num = 23.1; /* error C2086
here*/