-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

事前にt​​hx。

4

1 に答える 1