- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for test code below, 'insert' works, but emplace not.
#include <memory> #include <tbb/concurrent_unordered_map.h> struct A { A(int i): i_(i) {} int i_; }; int main() { tbb::concurrent_unordered_map<int, std::unique_ptr<A>> m; m.insert(std::make_pair(1, std::make_unique<A>(2))); m.emplace(2, std::make_unique<A>(2)); }
think it's due to insernal_insert uses pnode->my_element directly in
template<typename... Args> std::pair<iterator, bool> emplace(Args&&... args) { nodeptr_t pnode = my_solist.create_node_v(tbb::internal::forward<Args>(args)...); const sokey_t hashed_element_key = (sokey_t) my_hash_compare(get_key(pnode->my_element)); const sokey_t order_key = split_order_key_regular(hashed_element_key); pnode->init(order_key); return internal_insert(pnode->my_element, pnode); }
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page