【发布时间】:2013-05-21 05:54:58
【问题描述】:
我正在使用 Intel TBB Concurrent Hash Map tbb::hash_map<std::string, std::reference_wrapper<Clusters>>,我想使用
tbb::concurrent_hash_map<std::string, std::reference_wrapper<Clusters>>::accessor a;
if(table.find(a, operation.get().GetKey()))
{
a->second.get().AddOperation(operation);
}
但它给出了error: no matching function for call to ‘std::reference_wrapper<Clusters>::reference_wrapper()。所以问题是reference_wrapper 没有find 需要的默认构造函数。有什么办法可以规避这个吗?
【问题讨论】:
-
没有
std::hash_map,并且std::unordered_map没有名为accessor的成员。这些是来自某个图书馆吗? -
对不起,我认为 std hash_map 有相同的成员。它来自英特尔 TBB 并发哈希映射
-
是
find()报错吗?它似乎不需要这样的构造函数。你能展示GetKey()的实现吗? -
ParallelClusterCreator.h:27:54: required from here /usr/include/tbb/concurrent_hash_map.h:589:47: error: no matching function for call to ‘std::reference_wrapper<Clusters>::reference_wrapper()’ this is whole error message. -
GetKey很简单std::string GetKey() const { return key; }