get_default overloads
Declared in <folly/container/MapUtil.h>
Given a map and a key, return the value corresponding to the key in the map, or a given default value if the key doesn't exist in the map.
template<
typename Map,
typename Key = Map::key_type>
Map::mapped_type
get_default(
Map const& map,
Key const& key);
» more...
Give a map and a key, return the value corresponding to the key in the map, or a given default value if the key doesn't exist in the map.
template<
class Map,
typename Key = Map::key_type,
typename Func>
requires is_invocable_r_v<typename Map::mapped_type, Func>
Map::mapped_type
get_default(
Map const& map,
Key const& key,
Func&& dflt);
» more...
Given a map and a key, return the value corresponding to the key in the map, or the given default value if the key doesn't exist in the map.
template<
class Map,
typename Key = Map::key_type,
typename Value = Map::mapped_type>
requires !std::is_invocable_v<Value>
Map::mapped_type
get_default(
Map const& map,
Key const& key,
Value&& dflt);
» more...
Given a map and a path of keys, return the value corresponding to the nested value, or a given default value if the path doesn't exist in the map. The default value is the last parameter, and is copied when returned.
template<
class Map,
class Key1,
class Key2,
class... KeysDefault>
requires sizeof...(KeysDefault) != 0
/* implementation-defined */::type
get_default(
Map const& map,
Key1 const& key1,
Key2 const& key2,
KeysDefault const&... keysDefault);
» more...
| Name | Description |
|---|---|
| map | The map to search. |
| key | The key to look up. |
| dflt | A functor invoked to produce the default value. |
| key1 | The first key in the path. |
| key2 | The second key in the path. |
| keysDefault | The remaining keys followed by the default value. |