use*_*574 5 c++ hashmap std-pair
尝试在visual studio 2010下使用pair作为hash_map的键值.
无法编译它.
int _tmain(int argc, _TCHAR* argv[])
{
hash_map <pair<int, int>, int> months;
months[pair<int, int>(2,3)] = 1;
int d;
cin >> d;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
收到错误信息:
错误1错误C2440:'type cast':无法从'const std :: pair <_Ty1,_Ty2>'转换为'size_t'c:\ program files\microsoft visual studio 10.0\vc\include\xhash 34 1 testApplication1
我知道它可能是由于hash_mapddoes没有提供专业化pair.有什么简单的方法来解决它吗?谢谢