开发平台(Platform): (Ex: Win10, Linux, ...)
C/C++
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
VC++
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
std::map
问题(Question):
在执行insert时,跳出以下errors
喂入的资料(Input):
typedef struct AAA
{
float score;
bool compare;
} AAA;
预期的正确结果(Expected Output):
insert成功
错误结果(Wrong Output):
Error C2678 binary '<': no operator found which takes a left-hand operand
of type 'const AAA' (or there is no acceptable
conversion)
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\xstddef 239
程式码(Code):(请善用置底文网页, 记得排版,禁止使用图档)
std::map<AAA, int>AAAInfo;
AAA *pInfo = new AAA[1];
pInfo[0].score = 90;
pInfo[0].compare = true;
int nIndex = 2;
AAAInfo.insert(std::make_pair(pInfo[0], nIndex));
补充说明(Supplement):
用::value_type也一样