我想使用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 <为这种情况重载,但问题是我无法访问我想要使用的结构的代码(GUIDVC++中的结构).
这是代码片段:
//.h
#include <map>
using namespace std;
map<GUID,GUID> mapGUID;
//.cpp
GUID tempObj1, tempObj2;
mapGUID.insert( pair<GUID,GUID>(tempObj1, tempObj2) );
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题呢?