我有這樣的代碼:嵌套名稱 - 符
namespace mymap {
template <class Key,template <typename T > class Allocator> myownmap {
typedef pair<const unsigned int, Key> typename _myPair;
typedef multimap<unsigned int, Key,less<Key> ,Allocator<_myPair> > typename _entriesType;
}
}
它編譯成功(和作品)MSVC下,但是GCC抱怨無效的語法:
.hpp:20: error: expected nested-name-specifier before ‘_myPair’
.hpp:20: error: two or more data types in declaration of ‘_myPair’
我是什麼做錯了?
你真的用gcc測試了這個代碼嗎?您在myownmap之前缺少類/結構,並且「entriesPair」不會在代碼段中的任何位置出現。 – Philipp
你能告訴我們'entriesPair'的定義嗎? –
什麼是myownmap?它是一個功能還是類? – iammilind