[問題] 請問template中語法的問題
以下是小弟的程式碼
我原本在xlc++中編譯是沒問題的
但是我移到g++卻沒辦法編譯的
我在AIX與Linux中使用g++都會發生一樣的情況
請問是否有人知道該如何修改呢
template <typename VALUE>
class TestMapList
{
private:
typedef std::map< std::string , VALUE > MapList;
MapList m_mapList;
public:
TestMapList()
{
MapList::iterator _it;
}
virtual ~TestMapList(){}
};
///// 以下為錯誤訊息
../UnitTest_MapList.cpp:18: error: dependent-name ‘std::map::iterator’ is
parsed as a non-type, but instantiation yields a type
../UnitTest_MapList.cpp:18: note: say ‘typename std::map::iterator’ if a
type is meant
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.220.71.34
→
07/12 18:39, , 1F
07/12 18:39, 1F
→
07/12 19:49, , 2F
07/12 19:49, 2F
→
07/12 19:49, , 3F
07/12 19:49, 3F
→
07/12 20:04, , 4F
07/12 20:04, 4F
→
07/12 20:13, , 5F
07/12 20:13, 5F
→
07/12 20:14, , 6F
07/12 20:14, 6F
推
07/12 20:40, , 7F
07/12 20:40, 7F
→
07/12 20:48, , 8F
07/12 20:48, 8F
→
07/12 20:49, , 9F
07/12 20:49, 9F
→
07/12 21:00, , 10F
07/12 21:00, 10F
→
07/12 21:17, , 11F
07/12 21:17, 11F
推
07/12 21:18, , 12F
07/12 21:18, 12F
→
07/13 09:02, , 13F
07/13 09:02, 13F
推
07/14 13:42, , 14F
07/14 13:42, 14F
→
07/14 13:58, , 15F
07/14 13:58, 15F