AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
ABaseMap< KeyType, ValueType, Parent > Class Template Reference

Base class for maps with AUI extensions. More...

Detailed Description

template<class KeyType, class ValueType, class Parent>
class ABaseMap< KeyType, ValueType, Parent >

Base class for maps with AUI extensions.

Classes

struct  const_contains_iterator
 
struct  contains_iterator
 

Public Types

using iterator = typename Parent::iterator
 
using const_iterator = typename Parent::const_iterator
 

Public Member Functions

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
 

Member Function Documentation

◆ getOrInsert()

template<class KeyType , class ValueType , class Parent >
template<typename Factory >
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
keyTypekey;
factoryfactory function that will return a new value. Called only if map does not contain value of specified key.
Returns
stored or new value.

#include <AUI/Common/AMap.h>


The documentation for this class was generated from the following file:
Inheritance diagram for ABaseMap< KeyType, ValueType, Parent >:
Collaboration diagram for ABaseMap< KeyType, ValueType, Parent >: