エラー:C++のテンプレート、私はテンプレートクラスをコンパイルしようとすると、私は次のエラー得た使用のstdイテレータ
C.cpp: In member function 'void PeriodContainerAdvanced<T>::add()':
C.cpp:133: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
C.cpp:133: error: expected a type, got 'std::map<int,T,std::less<int>,std::allocator<std::pair<const int, T> > >::iterator'
C.cpp:133: error: invalid type in declaration before ';' token
Chのファイルでクラス:(簡体字)
template <class T>
class PeriodContainerAdvanced
{
[skip]
void add();
[skip]
}
C.cppを(簡体字):
template <class T>
void PeriodContainerAdvanced<T>::add()
{
[skip]
std::pair<std::map< time_t, T >::iterator, bool> ret; // line 133 !
[skip]
}
そして、他の機能で同様のエラー
を定義しようとしていますこのラインコンパイラ後std::map< time_t, T >::iterator it, it_start, it_end; // line 153
は言う:
C.cpp:153: error: expected `;' before 'it'
C.cpp:166: error: 'it_start' was not declared in this scope
それを修正する方法は?依存名だおかげ
ありがとう、その名前の – abrahab