【发布时间】:2020-11-11 02:02:32
【问题描述】:
下面是错误
std::mutex mtx;
auto t = std::make_pair(std::string("hello"), mtx);
但以下不是?
std::mutex mtx;
auto t = std::make_pair(std::string("hello"), 1);
我的最终目标是创建一个类型为无序的地图:
std::unordered_map<std::string, std::mutex>
使用:
mHeartBeatMutexes.insert(std::make_pair(std::string("hello"), mtx));
但是我的 IDE 说错了,我不知道为什么。
【问题讨论】:
-
是否允许复制构造函数?
标签: c++ unordered-map stdtuple