Base class for maps with AUI extensions.
#include <AUI/Common/AMap.h>
|
using | iterator = typename Parent::iterator |
|
using | const_iterator = typename Parent::const_iterator |
|
|
ValueType & | operator[] (KeyType &&k) |
|
ValueType & | operator[] (const KeyType &k) |
|
const ValueType & | operator[] (KeyType &&k) const |
|
const ValueType & | operator[] (const KeyType &k) const |
|
ValueType & | at (const KeyType &key) |
|
const ValueType & | at (const KeyType &key) const |
|
const_contains_iterator | contains (const KeyType &key) const noexcept |
|
contains_iterator | contains (const KeyType &key) noexcept |
|
AOptional< ValueType > | optional (const KeyType &key) const noexcept |
|
AVector< KeyType > | keyVector () |
|
AVector< ValueType > | valueVector () |
|
template<typename Factory> |
ValueType & | getOrInsert (const KeyType &keyType, Factory &&factory) noexcept(noexcept(factory())) |
|
template<typename BinaryOperation> |
auto | toVector (BinaryOperation &&transformer) const -> AVector< decltype(transformer(std::declval< KeyType >(), std::declval< ValueType >()))> |
|
AVector< std::tuple< KeyType, ValueType > > | toVector () const |
|
◆ getOrInsert()#
template<class KeyType, class ValueType, class Parent>
ValueType & ABaseMap< KeyType, ValueType, Parent >::getOrInsert |
( |
const KeyType & | keyType, |
|
|
Factory && | factory ) |
|
inlinenoexcept |
If value of specified key exists, the existing value returned. Otherwise, factory
function called.
- Parameters
-
keyType | key; |
factory | factory function that will return a new value. Called only if map does not contain value of specified key. |
- Returns
- stored or new value.