0
我想使用的std ::參考地圖使用參考::地圖
typedef const std::function<void(const cocos2d::Ref*)>& callBack;
std::map<const std::string&, callBack> m_mapListener
和我的錯誤信息是:
error C2535: 'const std::function<void (const cocos2d::Ref *)> &std::map<const std::string &,callBack,
std::less<_Kty>,std::allocator<std::pair<_Kty,_Ty>>>::operator [](const std::basic_string
<char,std::char_traits<char>,std::allocator<char>> &)' :
member function already defined or declared
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\map
我怎麼能解決這個問題?
這與'std :: function'無關。下一次執行一些實驗,例如拿掉'std :: function'並查看你的問題是否仍然存在(它的作用)。另外,在你的問題中提供正確的[testcases](http://stackoverflow.com/help/mcve):這裏你的錯誤信息抱怨'operator []',但是你實際上沒有使用'operator [] '。無論如何,我們都可以爲您解決問題。 –