
template <typename T,int i>class MyClass{private: typedef typename T::nested<i> Found;}; 给出这个错误信息:
source.cpp(5): error C2059: Syntax error : '<' source.cpp(6) : see reference to class template instantiation 'MyClass<T,i>' being compiled source.cpp(5): error C2238: unexpected token(s) preceding ';'
进一步在MyClass中,我可以使用T :: nested< i>,它只是typedef不起作用.
这个例子在2010年编译,而不是在2012年.这段代码有什么问题?
解决方法 每个VS版本对要求模板和类型名称越来越严格.你缺少一个模板,而VS2012是对的抱怨. 总结以上是内存溢出为你收集整理的c – 为什么这个模板代码可以在VS2010中运行,但不是在VS2012中运行?全部内容,希望文章能够帮你解决c – 为什么这个模板代码可以在VS2010中运行,但不是在VS2012中运行?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)