0
我试图创建一个使用unordered_map哈希表,但在Visual Studio 2010中没有实例得到了错误模板函数与unordered_map
IntelliSense: no instance of function template "std::tr1::unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>::emplace [with _Kty=std::string, _Ty=std::string, _Hasher=std::hash<std::string>, _Keyeq=std::equal_to<std::string>, _Alloc=std::allocator<std::pair<const std::string, std::string>>]" matches the argument list
以下代码段。上述错误出现在我使用emplace call的时候。如何解决这个错误?
#include<iostream>
#include<unordered_map>
#include<string>
int main()
{
std::tr1::unordered_map <std::string, std::string> hashtable;
std::tr1::unordered_map <int,int> intmap;
intmap.emplace(10,20);
hashtable.emplace("www.element14.com","184.51.49.225");
std::cout << "IP Address : " <<hashtable["www.element14.com"] <<std::endl;
return 0;
}
上述工作正常,如果我使用插入像'hashtable.insert(std :: make_pair(“www.newark.com”,“184.51.50.121”));' –