【发布时间】:2011-07-18 05:16:12
【问题描述】:
我想使用一个std::map,它的键和值元素都是结构。
我收到以下错误:
error C2784: 'bool std::operator <(const std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem *)' : could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Alloc> &' from 'const GUID
我知道在这种情况下我应该重载operator <,但问题是我无法访问我想要使用的结构的代码(VC++ 中的GUID 结构)。
这里是sn-p的代码:
//.h
#include <map>
using namespace std;
map<GUID,GUID> mapGUID;
//.cpp
GUID tempObj1, tempObj2;
mapGUID.insert( pair<GUID,GUID>(tempObj1, tempObj2) );
如何解决这个问题?
【问题讨论】:
标签: c++ stl visual-studio-2005 stdmap