std::unordered_map - 未定义模板的隐式实例化
std::unordered_map - Implicit instantiation of undefined template?
我已经做过很多语言,但我是C++新手,我对如何初始化类实例完全感到困惑。以下代码在
class MyClass
{
public:
//Hash map variable
//ERROR BELOW
std::unordered_map<int, float, std::hash<int>, std::equal_to<int>, std::allocator<int>> myUnorderedMap;
}
我想我填写的模板不正确。任何帮助都会很棒。
您需要包含库标头:
#include <unordered_map>
并且您不需要在声明中放置默认类型:
std::unordered_map<int, float> myUnorderedMap;
相关文章:
- 对显式实例化的模板函数的未定义引用
- 2个模板化类的非模板友元函数未定义引用错误
- 未定义的类模板不会实例化以检查友元函数
- OSX clang++:用于 cpp 文件中显式实例化模板的体系结构x86_64的未定义符号
- 是否是从等待返回到悬而未决的"this"实例的未定义行为?
- 未定义模板'std::__1::function<int (double, double, double, double)>'的隐式实例化
- 共享库:具有部分模板专用化和显式模板实例化的未定义引用
- boost序列化未定义引用
- 由类中未实例化的静态成员变量引起的未定义引用C++
- 模板函数实例化 自定义数据类型的问题
- 为什么不实例化未调用的模板类成员?
- 在自定义类中实例化自定义类时出现"expected type-specifier"错误
- std::unordered_map - 未定义模板的隐式实例化
- 未定义模板 'std::__1::array<int, 3>' 的隐式实例化
- 实例化在另一个项目中定义的类时未解析的外部
- 自定义Arduino库未实例化
- 未定义模板"QList"的 qt 隐式实例化<VPNConnection>
- 类实例化时未定义的引用错误
- 未定义模板的隐式实例化
- 具有未定义成员函数返回类型的模板实例化