jaulib v1.4.1-10-ga2c96e0
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator > Class Template Reference

HashMapWrap, generic std::unordered_map exposing a more higher level API. More...

#include <basic_collections.hpp>

Inheritance diagram for jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >:
Collaboration diagram for jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >:

Public Types

typedef const value_typeconst_reference
 
typedef Hash_functor hash_functor
 
typedef std::unordered_map< key_type, value_type, hash_functor, KeyEqual, Allocator > HashMapType
 
typedef Key_type key_type
 
typedef Novalue_type novalue_type
 
typedef HashMapType::value_type pair_type
 
typedef Query_type query_type
 
typedef value_typereference
 
typedef HashMapType::size_type size_type
 
typedef Value_type value_type
 

Public Member Functions

void clear ()
 Clears the hash map.
 
bool containsKey (const query_type &key) const
 Returns true if the given key maps to a value or no_value.
 
std::optional< const key_type & > containsValue (const_reference value) const
 Returns the key reference of the first value, otherwise std::nullopt.
 
const pair_typefind (const query_type &key) const
 Returns the immutable pair_type pointer for the given key or nullptr.
 
reference get (const query_type &key)
 Returns the mutable mapped value reference for the given key or novalue()
 
const_reference get (const query_type &key) const
 Returns the immutable mapped value reference for the given key or novalue()
 
bool insert (const key_type &key, const_reference obj)
 Adds a new mapping of the value for the given key, does nothing if a mapping exists.
 
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool insert (const Q &key, const_reference obj)
 Adds a new mapping of the value for the given key, does nothing if a mapping exists.
 
const HashMapTypemap () const noexcept
 
HashMapTypemap () noexcept
 converts novalue_type No_value to lvalue value_type to return its reference
 
constexpr const_reference novalue () const noexcept
 Returns the no-value immutable refererence no_value
 
constexpr reference novalue () noexcept
 Returns the no-value mutable refererence, no_value (should not be writable or written to)
 
bool put (const key_type &key, const_reference obj)
 Maps the value for the given key, overwrites old mapping if exists.
 
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool put (const Q &key, const_reference obj)
 Maps the value for the given key, overwrites old mapping if exists.
 
reference put2 (const key_type &key, const_reference obj)
 Maps the value for the given key, overwrites old mapping if exists.
 
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
reference put2 (const Q &key, const_reference obj)
 Maps the value for the given key, overwrites old mapping if exists.
 
value_type put3 (const key_type &key, const_reference obj)
 Maps the value for the given key, overwrites old mapping if exists.
 
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
value_type put3 (const Q &key, const_reference obj)
 Maps the value for the given key, overwrites old mapping if exists.
 
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool remove (const Q &key)
 Removes value if mapped and returns true, otherwise returns false.
 
bool remove (const query_type &key)
 Removes value if mapped and returns true, otherwise returns false.
 
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
value_type remove2 (const Q &key)
 Removes value if mapped and returns it, otherwise returns no_value.
 
value_type remove2 (const query_type &key)
 Removes value if mapped and returns it, otherwise returns no_value.
 
bool replace (const key_type &key, const_reference obj)
 Replaces the already mapped value for the given key, does nothing if no mapping exists.
 
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool replace (const Q &key, const_reference obj)
 Replaces the already mapped value for the given key, does nothing if no mapping exists.
 
size_type size () const noexcept
 

Detailed Description

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
requires std::constructible_from<Value_type, Novalue_type> && std::constructible_from<Key_type, Query_type>
class jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >

HashMapWrap, generic std::unordered_map exposing a more higher level API.

Allows using No_value for queries to signal no value found in map.

no_value will be returned by reference, including mutable reference. Hence caller must ensure that this special value is detected and not written to. This path has been chosen in favor of returning a nullptr.

Template Parameters
Key_typekey type
Value_typevalue type
Novalue_typevalue type representing no value, e.g. Value_type or std::nullptr_t for pointer. Requirement: Value_type must be constructible from Novalue_type.
No_valueno value query result of Novalue_type type, e.g. a Value_type -1, MAX_VALUE or nullptr for std::nullptr_t
Hash_functorHashing function object type, defaults to std::hash<Key_type>
Query_typekey query type, defaults to Key_type. Allows to sooth query parameter, e.g. string_view instead of string. Requirement: Key_type must be constructible from Query_type.
KeyEqualComparator function object type, defaults to std::equal_to<>
AllocatorAllocator type, defaults to std::allocator<std::pair<const Key_type, Value_type>>

Definition at line 123 of file basic_collections.hpp.

Member Typedef Documentation

◆ key_type

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef Key_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::key_type

Definition at line 125 of file basic_collections.hpp.

◆ query_type

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef Query_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::query_type

Definition at line 126 of file basic_collections.hpp.

◆ hash_functor

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef Hash_functor jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::hash_functor

Definition at line 127 of file basic_collections.hpp.

◆ value_type

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef Value_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::value_type

Definition at line 128 of file basic_collections.hpp.

◆ reference

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef value_type& jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::reference

Definition at line 131 of file basic_collections.hpp.

◆ const_reference

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef const value_type& jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::const_reference

Definition at line 132 of file basic_collections.hpp.

◆ novalue_type

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef Novalue_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::novalue_type

Definition at line 133 of file basic_collections.hpp.

◆ HashMapType

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef std::unordered_map<key_type, value_type, hash_functor, KeyEqual, Allocator> jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::HashMapType

Definition at line 135 of file basic_collections.hpp.

◆ size_type

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef HashMapType::size_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::size_type

Definition at line 136 of file basic_collections.hpp.

◆ pair_type

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
typedef HashMapType::value_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::pair_type

Definition at line 137 of file basic_collections.hpp.

Member Function Documentation

◆ map() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
HashMapType & jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::map ( )
inlinenoexcept

converts novalue_type No_value to lvalue value_type to return its reference

Definition at line 144 of file basic_collections.hpp.

◆ map() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
const HashMapType & jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::map ( ) const
inlinenoexcept

Definition at line 145 of file basic_collections.hpp.

◆ novalue() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
const_reference jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::novalue ( ) const
inlineconstexprnoexcept

Returns the no-value immutable refererence no_value

Definition at line 148 of file basic_collections.hpp.

◆ novalue() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
reference jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::novalue ( )
inlineconstexprnoexcept

Returns the no-value mutable refererence, no_value (should not be writable or written to)

Definition at line 150 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ size()

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
size_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::size ( ) const
inlinenoexcept

Definition at line 152 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ clear()

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
void jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::clear ( )
inline

Clears the hash map.

Definition at line 155 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ get() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
const_reference jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::get ( const query_type & key) const
inline

Returns the immutable mapped value reference for the given key or novalue()

Definition at line 158 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ get() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
reference jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::get ( const query_type & key)
inline

Returns the mutable mapped value reference for the given key or novalue()

Definition at line 166 of file basic_collections.hpp.

◆ find()

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
const pair_type * jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::find ( const query_type & key) const
inline

Returns the immutable pair_type pointer for the given key or nullptr.

Definition at line 175 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ containsKey()

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::containsKey ( const query_type & key) const
inline

Returns true if the given key maps to a value or no_value.

Definition at line 184 of file basic_collections.hpp.

◆ containsValue()

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
std::optional< const key_type & > jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::containsValue ( const_reference value) const
inline

Returns the key reference of the first value, otherwise std::nullopt.

Note: O(n) operation, slow.

Definition at line 189 of file basic_collections.hpp.

◆ insert() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::insert ( const key_type & key,
const_reference obj )
inline

Adds a new mapping of the value for the given key, does nothing if a mapping exists.

Returns
true if value is newly mapped, otherwise false doing nothing.

Definition at line 202 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ insert() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::insert ( const Q & key,
const_reference obj )
inline

Adds a new mapping of the value for the given key, does nothing if a mapping exists.

Returns
true if value is newly mapped, otherwise false doing nothing.

Definition at line 213 of file basic_collections.hpp.

◆ put() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::put ( const key_type & key,
const_reference obj )
inline

Maps the value for the given key, overwrites old mapping if exists.

Returns
true if value is newly mapped, otherwise false if replacing old mapping.

Definition at line 221 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ put() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::put ( const Q & key,
const_reference obj )
inline

Maps the value for the given key, overwrites old mapping if exists.

Returns
true if value is newly mapped, otherwise false if replacing old mapping.

Definition at line 238 of file basic_collections.hpp.

◆ put2() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
reference jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::put2 ( const key_type & key,
const_reference obj )
inline

Maps the value for the given key, overwrites old mapping if exists.

Consider using put() if old replaced value is not of interest.

Returns
newly successfully mapped value reference owned by this map or novalue()
See also
novalue()

Definition at line 256 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ put2() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
reference jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::put2 ( const Q & key,
const_reference obj )
inline

Maps the value for the given key, overwrites old mapping if exists.

Consider using put() if old replaced value is not of interest.

Returns
newly successfully mapped value reference owned by this map or novalue()
See also
novalue()

Definition at line 277 of file basic_collections.hpp.

◆ put3() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
value_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::put3 ( const key_type & key,
const_reference obj )
inline

Maps the value for the given key, overwrites old mapping if exists.

Consider using put() if old replaced value is not of interest.

Returns
previously mapped value or no_value.

Definition at line 294 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ put3() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
value_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::put3 ( const Q & key,
const_reference obj )
inline

Maps the value for the given key, overwrites old mapping if exists.

Consider using put() if old replaced value is not of interest.

Returns
previously mapped value or no_value.

Definition at line 315 of file basic_collections.hpp.

◆ replace() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::replace ( const key_type & key,
const_reference obj )
inline

Replaces the already mapped value for the given key, does nothing if no mapping exists.

Returns
true if mapped value is replaced, otherwise false doing nothing.

Definition at line 330 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ replace() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::replace ( const Q & key,
const_reference obj )
inline

Replaces the already mapped value for the given key, does nothing if no mapping exists.

Returns
true if mapped value is replaced, otherwise false doing nothing.

Definition at line 346 of file basic_collections.hpp.

◆ remove() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::remove ( const query_type & key)
inline

Removes value if mapped and returns true, otherwise returns false.

Definition at line 356 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ remove() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
bool jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::remove ( const Q & key)
inline

Removes value if mapped and returns true, otherwise returns false.

Definition at line 369 of file basic_collections.hpp.

◆ remove2() [1/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
value_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::remove2 ( const query_type & key)
inline

Removes value if mapped and returns it, otherwise returns no_value.

Consider using remove() if removed value is not of interest.

Returns
removed value or no_value.

Definition at line 385 of file basic_collections.hpp.

Here is the caller graph for this function:

◆ remove2() [2/2]

template<typename Key_type, typename Value_type, typename Novalue_type, Novalue_type No_value, typename Hash_functor = std::hash<Key_type>, typename Query_type = Key_type, typename KeyEqual = std::equal_to<>, typename Allocator = std::allocator<std::pair<const Key_type, Value_type>>>
template<class Q>
requires (!std::same_as<key_type, query_type>) && std::same_as<Q, query_type>
value_type jau::HashMapWrap< Key_type, Value_type, Novalue_type, No_value, Hash_functor, Query_type, KeyEqual, Allocator >::remove2 ( const Q & key)
inline

Removes value if mapped and returns it, otherwise returns no_value.

Consider using remove() if removed value is not of interest.

Returns
removed value or no_value.

Definition at line 405 of file basic_collections.hpp.


The documentation for this class was generated from the following file: