首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >c++中的concurrent_unordered_map

c++中的concurrent_unordered_map
EN

Stack Overflow用户
提问于 2012-04-09 01:32:57
回答 1查看 2.1K关注 0票数 1

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

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

代码语言:javascript
运行
复制
(.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)'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-09 01:50:27

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

  • 在评论中提到上面提到的链接问题。
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10064850

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档