类模板 使用iterator在VS2010编译通过,g++ 3.4.6报错,该如何处理

类模板 使用iterator在VS2010编译通过,g++ 3.4.6报错
出错行
std::queue< T >::const_iterator iter = _queue.begin();

报错信息
src/BlockingQueue.h: In member function `bool BlockingQueue<T>::contains(const T&) const':
src/BlockingQueue.h:61: error: expected `;' before "iter"
src/BlockingQueue.h:62: error: `iter' was not declared in this scope

------解决方案--------------------
试试 
typename std::queue< T >::const_iterator iter = _queue.begin();
------解决方案--------------------
引用:
试试 
typename std::queue< T >::const_iterator iter = _queue.begin();

++
没有 typename 的本来就应该不对,vs2010 没有严格执行标准。
------解决方案--------------------
引用:
Quote: 引用:

试试 
typename std::queue< T >::const_iterator iter = _queue.begin();

++
没有 typename 的本来就应该不对,vs2010 没有严格执行标准。

+1
微软的VS对一些标准问题处理的不如gcc严格,而且很多标准的更新都过于缓慢,甚至不更新