error C2146: 语法错误: 缺少“;”(在标识符“ITERATOR”的前面)

时间:2022-02-24 17:12:20
警告 1 warning C4346: “T::std::list<T*>::iterator”: 依赖名称不是类型 c:\users\administrator\code\iocpdemo\doublelist.h 17
错误 2 error C2146: 语法错误: 缺少“;”(在标识符“ITERATOR”的前面) c:\users\administrator\code\iocpdemo\doublelist.h 17
错误 3 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int c:\users\administrator\code\iocpdemo\doublelist.h 17
错误 4 error C2061: 语法错误: 标识符“ITERATOR” c:\users\administrator\code\iocpdemo\doublelist.h 37
错误 5 error C2061: 语法错误: 标识符“ITERATOR” c:\users\administrator\code\iocpdemo\doublelist.h 40
错误 6 error C2061: 语法错误: 标识符“ITERATOR” c:\users\administrator\code\iocpdemo\doublelist.h 41
报出这些错误,究竟啥原因呢特别第二个错误,我在vc6下就能编译通过,vs2010就不行,奇了怪了

template<class T, int COUNT>
class CDoubleList
{
public:
typedef std::list<T*> LIST;
typedef std::list<T*>::iterator ITERATOR;
public:
CDoubleList();
virtual ~CDoubleList();
private:
CRITICAL_SECTION m_critical_section;
protected:
LIST m_0_list;
LIST m_1_list;
private:
inline void Base_InitSize(LIST &list,int count);
inline void Base_RemoveAll(LIST &list);

inline void Init();
inline void RemoveAll();
public:
int GetCount();
int GetBlankCount();

T* GetBlank();
T* RemoveAt(ITERATOR pos);
T* RemoveAt(T* lp_t);

void GetHeadPosition(ITERATOR&pos);
T* GetNext(ITERATOR&pos);

T* GetHead();
T* RemoveHead();

T* GetOwnCycleNext();

void PutToBlank();

////////////////////////////////////////////////////////////

T* GetFromBlank();
T* PutToBlank(T*lp_t);
T* GetFromUse();
T* PutToUse(T*lp_t);
};

1 个解决方案

#1


http://bbs.csdn.net/topics/391027372

#1


http://bbs.csdn.net/topics/391027372