-1

我想做一个模板函数来输出 boost::circular_buffer 的内容。这是有问题的代码段:

template <typename T>
std::ostream& operator<<(std::ostream& os, const boost::circular_buffer<T>& cb){
   boost::circular_buffer<T>::const_iterator it;
   for(it=cb.begin(); it!=cb.end(); it++){
      os << it;
   }
   os << std::endl;
   return os;
}

出现以下错误:

need ‘typename’ before boost::circular_buffer<T>::const_iterator’ because ‘boost::circular_buffer<T>’ is a dependent scope

提前谢谢。

4

1 回答 1

2
于 2013-03-20T14:32:07.720 回答