30 template <
typename Map,
typename Key>
32 auto pos = map.find(key);
33 return (pos != map.end()) ? (pos->second) : (
typename Map::mapped_type{});
37 typename Key =
typename Map::key_type,
38 typename Value =
typename Map::mapped_type,
40 typename Map::mapped_type
42 using M =
typename Map::mapped_type;
43 auto pos = map.find(key);
44 return (pos != map.end()) ? (pos->second) :
M(std::forward<Value>(dflt));
53 typename Key =
typename Map::key_type,
55 typename =
typename std::enable_if<
57 typename Map::mapped_type
59 auto pos = map.find(key);
60 return pos != map.end() ? pos->second : dflt();
68 class E = std::out_of_range,
70 typename Key =
typename Map::key_type>
75 auto pos = map.find(key);
76 if (pos != map.end()) {
79 throw E(folly::to<std::string>(exceptionStrPrefix, key));
83 class E = std::out_of_range,
85 typename Key =
typename Map::key_type>
90 auto pos = map.find(key);
91 if (pos != map.end()) {
94 throw E(folly::to<std::string>(exceptionStrPrefix, key));
101 template <
class Map,
typename Key =
typename Map::key_type>
105 auto pos = map.find(key);
106 if (pos != map.end()) {
118 template <
class Map,
typename Key =
typename Map::key_type>
122 const typename Map::mapped_type& dflt) {
123 auto pos = map.find(key);
124 return (pos != map.end() ? pos->second : dflt);
133 template <
class Map,
typename Key =
typename Map::key_type>
137 typename Map::mapped_type&& dflt) =
delete;
139 template <
class Map,
typename Key =
typename Map::key_type>
143 const typename Map::mapped_type&& dflt) =
delete;
152 typename Key =
typename Map::key_type,
154 typename =
typename std::enable_if<
156 typename =
typename std::enable_if<
157 std::is_reference<invoke_result_t<Func>>
::value>::type>
158 const typename Map::mapped_type&
160 auto pos = map.find(key);
161 return (pos != map.end() ? pos->second : dflt());
168 template <
class Map,
typename Key =
typename Map::key_type>
169 const typename Map::mapped_type*
get_ptr(
const Map& map,
const Key& key) {
170 auto pos = map.find(key);
171 return (pos != map.end() ? &pos->second :
nullptr);
177 template <
class Map,
typename Key =
typename Map::key_type>
178 typename Map::mapped_type*
get_ptr(Map& map,
const Key& key) {
179 auto pos = map.find(key);
180 return (pos != map.end() ? &pos->second :
nullptr);
189 class =
typename std::enable_if<(pathLength > 0)>::
type>
196 using type =
typename T::mapped_type;
199 template <
typename... KeysDefault>
202 template <
typename Default>
207 template <
typename Key,
typename... KeysDefault>
212 template <
class... KeysDefault>
214 typename DefaultType<KeysDefault...>::type
const& {
215 return std::get<
sizeof...(KeysDefault) - 1>(std::tie(keysDefault...));
223 template <
class Map,
class Key1,
class Key2,
class... Keys>
231 auto pos = map.find(key1);
232 return pos != map.end() ?
get_optional(pos->second, key2, keys...)
240 template <
class Map,
class Key1,
class Key2,
class... Keys>
245 const Keys&... keys) ->
247 auto pos = map.find(key1);
248 return pos != map.end() ?
get_ptr(pos->second, key2, keys...) :
nullptr;
251 template <
class Map,
class Key1,
class Key2,
class... Keys>
252 auto get_ptr(Map& map,
const Key1& key1,
const Key2& key2,
const Keys&... keys)
254 auto pos = map.find(key1);
255 return pos != map.end() ?
get_ptr(pos->second, key2, keys...) :
nullptr;
267 class... KeysDefault,
268 typename =
typename std::enable_if<
sizeof...(KeysDefault) != 0>::
type>
273 const KeysDefault&... keysDefault) ->
291 class... KeysDefault,
292 typename =
typename std::enable_if<
sizeof...(KeysDefault) != 0>::
type,
293 typename =
typename std::enable_if<std::is_lvalue_reference<
299 KeysDefault&&... keysDefault) ->
const Map::mapped_type * get_ptr(const Map &map, const Key &key)
Map::mapped_type get_default(const Map &map, const Key &key)
const Map::mapped_type & get_ref_default(const Map &map, const Key &key, const typename Map::mapped_type &dflt)
internal::KeyMatcher< M > Key(M inner_matcher)
—— Concurrent Priority Queue Implementation ——
std::unordered_map< int64_t, VecT > Map
typename NestedMapType< T, pathLength-1 >::type::mapped_type type
typename T::mapped_type type
bool Value(const T &value, M matcher)
folly::Optional< typename Map::mapped_type > get_optional(const Map &map, const Key &key)
static const char *const value
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
const Map::mapped_type & get_or_throw(const Map &map, const Key &key, const std::string &exceptionStrPrefix=std::string())
PUSHMI_INLINE_VAR constexpr detail::get_fn< T > get
typename DefaultType< KeysDefault... >::type type
auto extract_default(const KeysDefault &...keysDefault) -> typename DefaultType< KeysDefault... >::type const &