在我试图汇编模板类别时,我发现以下错误:
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
C.h档案中的班级:(简化)
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]
}
And the similar error at other function when trying to define
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
How to fix it? thanks