1 #ifndef canvas_Persistency_Provenance_thread_safe_registry_via_id_h 2 #define canvas_Persistency_Provenance_thread_safe_registry_via_id_h 26 #include "tbb/concurrent_unordered_map.h" 28 #include <type_traits> 47 std::ostringstream os;
49 return tbb::tbb_hasher(os.str());
54 template <
typename K,
typename M>
58 tbb::concurrent_unordered_map<K, M, detail::hash_to_size_t<K>>;
62 static void put(C
const& container);
64 static auto emplace(
K const& key, M
const& mapped);
67 static bool get(
K const& key, M& mapped);
78 template <
typename K,
typename M>
83 auto& me = instance();
84 for (
auto const&
e : container) {
89 template <
typename K,
typename M>
93 return instance().emplace(value);
96 template <
typename K,
typename M>
100 return instance().emplace(key, mapped);
103 template <
typename K,
typename M>
107 return instance().empty();
110 template <
typename K,
typename M>
117 template <
typename K,
typename M>
121 auto& me = instance();
122 auto it = me.find(k);
123 if (it != me.cend()) {
static void put(C const &container)
typename collection_type::value_type value_type
static collection_type const & get()
tbb::concurrent_unordered_map< K, M, detail::hash_to_size_t< K >> collection_type
std::enable_if_t< is_instantiation_of_hash< H >::value, std::size_t > operator()(H const &id) const
std::string value(boost::any const &)
static auto emplace(value_type const &value)