get_optional overloads
Synopses
Declared in <folly/container/MapUtil.h>
Given a map and a key, return a OptionalValue if the key exists and None if the key does not exist in the map.
template<
class OptionalValue,
class Map,
typename Key = Map::key_type>
OptionalValue
get_optional(
Map const& map,
Key const& key);
Given a map and a key, return a Optional<V> if the key exists and None if the key does not exist in the map.
template<
template<typename> typename Optional = Optional,
class Map,
typename Key = Map::key_type>
Optional<Map::mapped_type>
get_optional(
Map const& map,
Key const& key);
Given a map of maps and a path of keys, return a Optional<V> if the nested key exists and None if the nested keys does not exist in the map.
template<
template<typename> typename Optional = Optional,
class Map,
class Key1,
class Key2,
class... Keys>
Optional</* implementation-defined */::type>
get_optional(
Map const& map,
Key1 const& key1,
Key2 const& key2,
Keys const&... keys);
Return Value
-
The value wrapped in an OptionalValue, or None if absent.
-
The value wrapped in an Optional, or None if absent.
-
The nested value if the path exists, or None otherwise.
Parameters
Name |
Description |
map |
The map to search. |
key |
The key to look up. |
key1 |
The first key in the path. |
key2 |
The second key in the path. |
keys |
The remaining keys in the path. |
Created with MrDocs