1 #ifndef canvas_Persistency_Provenance_thread_safe_registry_via_id_h 2 #define canvas_Persistency_Provenance_thread_safe_registry_via_id_h 29 #include <type_traits> 32 template <
typename K,
typename M>
39 static void put(C
const& container);
41 static auto emplace(K
const& key, M
const& mapped);
44 static bool get(K
const& key, M& mapped);
48 std::lock_guard sentry{
mutex_()};
66 static std::recursive_mutex m{};
71 template <
typename K,
typename M>
76 std::lock_guard sentry{
mutex_()};
78 for (
auto const&
e : container) {
83 template <
typename K,
typename M>
87 std::lock_guard sentry{
mutex_()};
91 template <
typename K,
typename M>
95 std::lock_guard sentry{
mutex_()};
96 return instance()->emplace(key, mapped);
99 template <
typename K,
typename M>
103 std::lock_guard sentry{
mutex_()};
107 template <
typename K,
typename M>
114 template <
typename K,
typename M>
118 std::lock_guard sentry{
mutex_()};
120 auto it = me->find(k);
121 if (it != me->cend()) {
static void put(C const &container)
typename collection_type::value_type value_type
std::map< K, M > collection_type
static collection_type const & get()
static auto instance(bool cleanup=false)
static auto emplace(value_type const &value)