std::map threadsafe_lookup_table::get_map() const { std::vector> locks; for (unsigned i = 0; i < buckets.size(); ++i) { locks.push_back(std::unique_lock(buckets[i].mutex)); } std::map res; for (unsigned i = 0; i < buckets.size(); ++i) { for (bucket_iterator it = buckets[i].data.begin(); it != buckets[i].data.end(); ++it) { res.insert(*it); } } return res; }