大佬教程收集整理的这篇文章主要介绍了c – 为什么此类声明不适用于Visual Studio,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
class value_t { public: typedef std::deque<value_t> sequence_t; typedef sequence_t::iterator iterator; };
此代码失败:
1>cpptest.cpp 1>c:\program files\microsoft visual studio 9.0\vc\include\deque(518) : error C2027: use of undefined type 'value_t' 1> c:\temp\cpptest\cpptest.cpp(10) : see declaration of 'value_t' 1> c:\temp\cpptest\cpptest.cpp(13) : see reference to class template instantiation 'std::deque<_Ty>' being compiled 1> with 1> [ 1> _Ty=value_t 1> ] 1>c:\program files\microsoft visual studio 9.0\vc\include\deque(518) : error C2027: use of undefined type 'value_t' 1> c:\temp\cpptest\cpptest.cpp(10) : see declaration of 'value_t'
但是当我用std :: vector尝试这个时,编译很好:
class value_t { public: typedef std::vector<value_t> sequence_t; typedef sequence_t::iterator iterator; };
怎么了?我试过在我能想到的任何地方添加’typename’,但此时此刻我认为它只是Dinkumware STL中的一个错误.谁能解释发生了什么,和/或提供解决方案?谢谢.
以上是大佬教程为你收集整理的c – 为什么此类声明不适用于Visual Studio全部内容,希望文章能够帮你解决c – 为什么此类声明不适用于Visual Studio所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。