46 template <
typename K_TYPE,
49 class map :
public container<couple<const K_TYPE, V_TYPE>, ALLOC> {
55 explicit map(ALLOC alloc = ALLOC{});
65 virtual bool add(
const K_TYPE& k,
const V_TYPE& v) = 0;
73 virtual bool remove(
const K_TYPE& k) = 0;
80 [[nodiscard]]
virtual bool containsKey(
const K_TYPE& k)
const = 0;
88 virtual V_TYPE
get(
const K_TYPE& k)
const = 0;
98 virtual bool update(
const K_TYPE &key,
const V_TYPE &value) = 0;
126 template<
typename K_TYPE,
typename V_TYPE,
typename ALLOC>
130 template<
typename K_TYPE,
typename V_TYPE,
typename ALLOC>
Memory allocation interface and implementations.
Default memory allocator using allocators utilities.
Definition allocator.h:154
Abstract base class for containers.
Definition container.h:28
Container for two heterogeneous elements.
Definition couple.h:37
virtual V_TYPE & operator[](const K_TYPE &k)=0
Non-const access to mapped values.
virtual V_TYPE get(const K_TYPE &k) const =0
Gets the value associated with a key.
~map() override
Virtual destructor.
map(ALLOC alloc=ALLOC{})
Constructs a map with the specified allocator.
Definition map.h:127
virtual bool containsKey(const K_TYPE &k) const =0
Checks if a key exists in the map.
virtual const V_TYPE & operator[](const K_TYPE &k) const =0
Const access to mapped values.
virtual bool remove(const K_TYPE &k)=0
Removes a key-value pair from the map.
virtual bool add(const K_TYPE &k, const V_TYPE &v)=0
Adds a new key-value pair to the map.
virtual bool update(const K_TYPE &key, const V_TYPE &value)=0
Updates the value for an existing key.
Abstract base class for container types.
Generic pair container implementation.
Main namespace for the project Original.
Definition algorithms.h:21