1 #ifndef cetlib_registry_via_id_h 2 #define cetlib_registry_via_id_h 11 #include "cetlib_except/exception.h" 15 #include <type_traits> 18 template <
class K,
class V>
22 template <
class K,
class V, K (V::*)() const = &V::
id>
31 template <
class K,
class V>
40 using key_type =
typename collection_type::key_type;
43 using size_type =
typename collection_type::size_type;
50 return the_registry_().empty();
55 return the_registry_().size();
62 return the_registry_().begin();
67 return the_registry_().end();
72 return the_registry_().cbegin();
77 return the_registry_().cend();
84 template <
class FwdIt>
85 static std::enable_if_t<
86 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
91 template <
class FwdIt>
92 static std::enable_if_t<
93 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
95 put(FwdIt begin, FwdIt end);
104 return the_registry_();
106 static V
const&
get(
K const&
key);
107 static bool get(
K const&
key, V&
value) noexcept;
123 template <
class K,
class V>
128 the_registry_().emplace(
id, value);
132 template <
class K,
class V>
133 template <
class FwdIt>
136 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
mapped_type>>
142 template <
class K,
class V>
143 template <
class FwdIt>
146 std::is_same_v<typename std::iterator_traits<FwdIt>::value_type,
value_type>>
148 the_registry_().insert(
b,
e);
151 template <
class K,
class V>
155 put(c.cbegin(), c.cend());
161 template <
class K,
class V>
166 if (it == the_registry_().
end())
168 <<
"Key \"" << key <<
"\" not found in registry";
172 template <
class K,
class V>
178 if (it == the_registry_().
end()) {
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
typename collection_type::const_iterator const_iterator
typename collection_type::mapped_type mapped_type
static const_iterator begin()
int find(char c, int index=0, bool cs=TRUE) const
static const_iterator end()
static collection_type & the_registry_()
typename collection_type::key_type key_type
typename collection_type::value_type value_type
static const_iterator cend()
typename collection_type::size_type size_type
std::map< K const, V > collection_type
static collection_type const & get() noexcept
static detail::must_have_id< K, V >::type put(V const &value)
static const_iterator cbegin()
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
cet::coded_exception< error, detail::translate > exception