关于模版具现的问题
#include <iostream>
#include <list>
using namespace std;
template <typename T>
int test(T val)
{
list <T *>::iterator _it;
return 0;
}
int main()
{
int i;
test(i);
}
在list <T *>::iterator _it;这个地方,GCC会报错:
STL.cpp: In function `int test(T)':
STL.cpp:8: error: expected `;' before "_it"
STL.cpp: In function `int test(T) [with T = int]':
STL.cpp:16: instantiated from here
STL.cpp:8: error: dependent-name ` std::list<T*,std::allocator<T*> >::iterator' is parsed as a non-type, but instantiation yields a type
STL.cpp:8: note: say `typename std::list<T*,std::allocator<T*> >::iterator' if a type is meant
bcc32则不会,为何?是否是GCC对于嵌套的模版具现有不同的实现?