繁体   English   中英

c++ 中的 concurrent_unordered_map

[英]concurrent_unordered_map in c++

我有一个串行运行的算法,我打算将它并行化。 现在,这个算法在 C++11 中使用了unordered_map 。我可以直接用concurrent_unordered_map代替它吗?

我只想指出,我已经尝试这样做,但它似乎会产生难以理解的错误。 像这个:

(.text._ZN3tbb13tbb_allocatorINS_10interface58internal18split_ordered_listISt4pairIKSsSt6vectorIjSaIjEEENS0_IS9_EEE4nodeEE8allocateEjPKv[tbb::tbb_allocator<tbb::interface5::internal::split_ordered_list<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<unsigned int, std::allocator<unsigned int> > >, tbb::tbb_allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<unsigned int, std::allocator<unsigned int> > > > >::node>::allocate(unsigned int, void const*)]+0x16): undefined reference to `tbb::internal::allocate_via_handler_v3(unsigned int)'

concurrent_unordered_map 允许并发插入和并发读取,但不允许并发删除。 所以只要你在添加/迭代时不删除你应该没问题。

  • 上面评论中提到的链接问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM