A constexpr associative container with reasonably fast key-based lookup. More...
#include <DynamicMap.h>
Data Structures | |
struct | OnlyFirstComparator |
struct | OnlyFirstEquality |
Public Member Functions | |
Special member functions | |
constexpr | DynamicMap ()=default |
constexpr | DynamicMap (DynamicMap &&other) noexcept |
constexpr | DynamicMap (const DynamicMap &other) |
constexpr DynamicMap & | operator= (const DynamicMap &other) |
constexpr DynamicMap & | operator= (DynamicMap &&other) noexcept |
Modification | |
constexpr void | insert (KeyType key, MappedType item) |
Inserts an element into the map. More... | |
constexpr void | insertOrUpdate (KeyType key, MappedType item) |
Inserts a key-value pair into the map or updates the mapped value if the key exists. More... | |
constexpr void | clear () |
Inserts an element into the map. More... | |
Information | |
constexpr const MappedType & | at (const KeyType &key) const |
Value lookup. More... | |
constexpr unsigned | size () const |
Number of items in the map. More... | |
Operators | |
constexpr bool | operator== (const DynamicMap &other) const |
constexpr bool | operator!= (const DynamicMap &other) const |
constexpr bool | operator< (const DynamicMap &other) const |
constexpr bool | operator> (const DynamicMap &other) const |
Private Types | |
using | PairType = Pair< KeyType, MappedType > |
using | SetType = DynamicSet< PairType, N, OnlyFirstComparator, OnlyFirstEquality > |
Private Attributes | |
SetType | items_ |
Iterators | |
using | const_iterator = typename SetType::const_iterator |
constexpr const_iterator | begin () const |
constexpr const_iterator | end () const |
A constexpr associative container with reasonably fast key-based lookup.
Requires that MappedType is default-constructible
KeyType | Type of the key in the map |
MappedType | Value type of the map |
N | Maximum number of elements in the map |
|
inline |
Value lookup.
Complexity \(\Theta(N \log N)\)
|
inline |
Inserts an element into the map.
Complexity \(\Theta(N \log N)\)
|
inline |
Inserts an element into the map.
Complexity \(\Theta(N \log N)\)
|
inline |
Inserts a key-value pair into the map or updates the mapped value if the key exists.
Complexity \(\Theta(N \log N)\)
|
inline |
Number of items in the map.
Complexity \(\Theta(1)\)