|
| | flat_map ()=default |
| |
| | flat_map (std::initializer_list< std::pair< Key, Value > > init) |
| | Construct from an initializer list of key-value pairs.
|
| |
| iterator | begin () |
| | Return iterator to the first element.
|
| |
| const_iterator | begin () const |
| | Return const iterator to the first element.
|
| |
| const_iterator | cbegin () const |
| | Return const iterator to the first element.
|
| |
| iterator | end () |
| | Return iterator past the last element.
|
| |
| const_iterator | end () const |
| | Return const iterator past the last element.
|
| |
| const_iterator | cend () const |
| | Return const iterator past the last element.
|
| |
| size_t | size () const |
| | Return the number of key-value pairs.
|
| |
| bool | empty () const |
| | Return true if the map contains no elements.
|
| |
| void | reserve (size_t n) |
| | Reserve storage for at least n elements.
|
| |
| size_t | capacity () const |
| | Return the current storage capacity.
|
| |
| template<class K , class = std::enable_if_t<std::is_convertible<K, Key>{}>> |
| Value & | operator[] (K &&k) |
| | Access or insert the value for key k.
|
| |
| template<class K , class = std::enable_if_t<std::is_convertible<K, Key>{}>> |
| iterator | find (K &&k) |
| | Find the element with key k.
|
| |
| template<class K , class = std::enable_if_t<std::is_convertible<K, Key>{}>> |
| const_iterator | find (K &&k) const |
| | Find the element with key k (const overload).
|
| |
| iterator | erase (const_iterator it) |
| | Remove the element at it.
|
| |
| template<class P , class = std::enable_if_t<std::is_convertible<P,std::pair<Key, Value>>{}>> |
| void | insert (P &&value) |
| | Insert or update a key-value pair.
|
| |
| bool | operator== (const flat_map &rhs) const |
| | Compare two flat_maps for equality.
|
| |
| bool | operator< (const flat_map &rhs) const |
| | Lexicographic less-than comparison (order-independent on keys).
|
| |
template<class Key, class Value, template< class... >class Storage = std::vector>
struct flat_map< Key, Value, Storage >
Flat associative map with pluggable storage.
- Template Parameters
-
| Key | Key type. Must be equality-comparable. |
| Value | Mapped value type. |
| Storage | Container template used for storage (default: std::vector). Must support emplace_back, erase, begin, end, size, and empty. |
Definition at line 49 of file flat_map.hpp.
template<class Key , class Value , template< class... >class Storage = std::vector>
template<class K , class = std::enable_if_t<std::is_convertible<K, Key>{}>>
Find the element with key k.
- Parameters
-
- Returns
- Iterator to the element, or
end() if not found.
Definition at line 137 of file flat_map.hpp.
template<class Key , class Value , template< class... >class Storage = std::vector>
template<class K , class = std::enable_if_t<std::is_convertible<K, Key>{}>>
Find the element with key k (const overload).
- Parameters
-
- Returns
- Const iterator to the element, or
end() if not found.
Definition at line 146 of file flat_map.hpp.
template<class Key , class Value , template< class... >class Storage = std::vector>
template<class P , class = std::enable_if_t<std::is_convertible<P,std::pair<Key, Value>>{}>>
| void flat_map< Key, Value, Storage >::insert |
( |
P && |
value | ) |
|
|
inline |
Insert or update a key-value pair.
- Parameters
-
| value | Key-value pair to insert or update. |
Definition at line 162 of file flat_map.hpp.
template<class Key , class Value , template< class... >class Storage = std::vector>
template<class K , class = std::enable_if_t<std::is_convertible<K, Key>{}>>
| auto flat_map< Key, Value, Storage >::key_match |
( |
K & |
k | ) |
|
|
inlineprivate |
Return a predicate matching key k.
- Parameters
-
- Returns
- Lambda matching pairs whose first element equals
k.
Definition at line 125 of file flat_map.hpp.
template<class Key , class Value , template< class... >class Storage = std::vector>
template<class K , class = std::enable_if_t<std::is_convertible<K, Key>{}>>
| Value & flat_map< Key, Value, Storage >::operator[] |
( |
K && |
k | ) |
|
|
inline |
Access or insert the value for key k.
- Parameters
-
| k | Key to look up or insert. |
- Returns
- Reference to the associated value.
Definition at line 116 of file flat_map.hpp.