SPH
|
Container of key-value pairs. More...
#include <FlatMap.h>
Classes | |
struct | Element |
Element of the container. More... | |
Public Member Functions | |
FlatMap ()=default | |
FlatMap (std::initializer_list< Element > list) | |
Constructs the map fromm initializer list of elements. More... | |
INLINE TValue & | operator[] (const TKey &key) |
Returns a reference to the element, given its key. More... | |
INLINE const TValue & | operator[] (const TKey &key) const |
Returns a reference to the element, given its key. More... | |
INLINE TValue & | insert (const TKey &key, const TValue &value) |
Adds a new element into the map or sets new value of element with the same key. More... | |
INLINE TValue & | insert (const TKey &key, TValue &&value) |
Adds a new element into the map or sets new value of element with the same key. More... | |
INLINE void | remove (const TKey &key) |
Removes element with given key from the map. More... | |
INLINE bool | tryRemove (const TKey &key) |
Removes element with given key if present, otherwise it does nothing. More... | |
INLINE void | clear () |
Removes all elements from the map. More... | |
INLINE Optional< TValue & > | tryGet (const TKey &key) |
Returns a reference to the value matching the given key, or NOTHING if no such value exists. More... | |
INLINE Optional< const TValue & > | tryGet (const TKey &key) const |
Returns a reference to the value matching the given key, or NOTHING if no such value exists. More... | |
INLINE bool | contains (const TKey &key) const |
Returns true if the map contains element of given key. More... | |
INLINE Size | size () const |
Returns the number of elements in the map. More... | |
INLINE Size | empty () const |
Returns true if the map contains no elements, false otherwise. More... | |
INLINE Iterator< Element > | begin () |
Returns the iterator pointing to the first element. More... | |
INLINE Iterator< const Element > | begin () const |
Returns the iterator pointing to the first element. More... | |
INLINE Iterator< Element > | end () |
Returns the iterator pointing to the one-past-last element. More... | |
INLINE Iterator< const Element > | end () const |
Returns the iterator pointing to the one-past-last element. More... | |
INLINE | operator ArrayView< Element > () |
INLINE | operator ArrayView< const Element > () const |
FlatMap | clone () const |
Container of key-value pairs.
Elements are stored in an array sorted according to key. The value look-up is O(log(N)), while inserting or deletion of elements is currently O(N).
|
default |