|
- #include <vector>
- template <class TClass>
- class test
- {
- public:
- test(){};
- ~test(){};
- void hello()
- {
- std::vector<TClass*>::iterator it;
- }
- };
- main()
- {
- }
复制代码
std::vector<TClass*>::iterator it;这行出错。
用gcc3.2.2编译时只是警告:- -bash-2.05b$ g++ test.cxx
- test.cxx: In member function `void test<TClass>::hello()':
- test.cxx:11: warning: `typename std::vector<TClass*, std::allocator<TClass*>
- >::iterator' is implicitly a typename
- test.cxx:11: warning: implicit typename is deprecated, please see the
- documentation for details
复制代码
但gcc3.4.6就报错:- test.cxx: In member function `void test<TClass>::hello()':
- test.cxx:11: error: expected `;' before "it"
复制代码
这行要怎样改?万分感谢! |
|