I'm trying to replace a std::unordered_map
with a tbb::concurrent_hash_map
.
My original code:
typedef std::unique_ptr<V> V_ptr;
std::unordered_map<K, V_ptr> hm;
V_ptr v (new V);
K k;
hm.insert (std::make_pair (k, std::move (v)));
compiles fine with clang 3.3. Switching the unordered_map to a concurrent_hash_map:
typedef std::unique_ptr<V> V_ptr;
tbb::concurrent_hash_map<K, V_ptr> hm;
V_ptr v (new V);
K k;
hm.insert (std::make_pair (k, std::move (v)));
results in the error: ...stl_pair.h:105:21: error: call to deleted constructor of
'std::unique_ptr<...
Is this a bug in clang 3.3? I remember there being similar errors in gcc 4.5 when using std::unique_ptrs in many containers. (The above original code will not compile with gcc 4.5 for ex.) Or maybe I missed something about concurrent_hash_maps?