阅读《STL源码剖析》》
有以下代码,敲在VC++6.0中,编译错误。
#include<iostream>
using namespace std;
template<typename T>
class testClass{
public:
const static int _datai=5;
const static char _datac='c';
};
int main()
{
cout<<testClass::_datai<<endl;
cout<<testClass::_datac<<endl;
return 0;
}
const static int _datai=5;该行代码提示 illegal pure syntax, must be '= 0'。
转而在VS2013中运行无错误,应该是VC编译器的问题,具体原因尚不清楚,记录一下。