【问题标题】:C++ unordered_map errors when pointing to a vector指向向量时出现 C++ unordered_map 错误
【发布时间】:2014-10-29 13:30:05
【问题描述】:

我在使用下面的无序地图时遇到了一些问题:

unordered_map<string, vector<string>> FriendHash;

编译代码时出现以下错误:

usr/lib/c++/v1/type_traits:922:38: Implicit instantiation of undefined template 'std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'

usr/lib/c++/v1/unordered_map:360:71: No member named 'value' in 'std::__1::is_empty<std::__1::hash<std::__1::basic_string<char> > >'

希望有人能指出我正确的方向。

【问题讨论】:

  • #include &lt;string&gt;.

标签: c++ hash hashtable unordered-map


【解决方案1】:

无论你使用什么都需要定义。您可能需要在此处包含字符串以及其他依赖项。

#include <string>

【讨论】:

    猜你喜欢
    • 2013-11-19
    • 1970-01-01
    • 1970-01-01
    • 2020-03-20
    • 2017-09-20
    • 2021-08-05
    • 2020-02-07
    • 1970-01-01
    • 2019-09-02
    相关资源
    最近更新 更多