template<typename Key, typename Value, int MaxSize, typename KeyHash = hash<Key>, typename KeyEqual = equal_to<Key>>
bn::unordered_map class

std::unordered_map like container with a fixed size buffer.

Template parameters
Key Key type.
Value Value type.
MaxSize Maximum number of elements that can be stored.
KeyHash Functor used to calculate the hash of a given key.
KeyEqual Functor used for all key comparisons.

It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.

Unlike std::unordered_map, it doesn't offer pointer stability when moving or erasing elements.

Base classes

template<typename Key, typename Value, typename KeyHash = hash<Key>, typename KeyEqual = equal_to<Key>>
class iunordered_map<Key, Value, hash<Key>, equal_to<Key>>
Base class of bn::unordered_map.

Public types

using key_type = Key
Key type alias.
using mapped_type = Value
Value type alias.
using value_type = pair<const key_type, mapped_type>
(Key, Value) pair type alias.
using size_type = int
Size type alias.
using difference_type = int
Difference type alias.
using hash_type = unsigned
Hash type alias.
using hasher = KeyHash
Hash functor alias.
using key_equal = KeyEqual
Equality functor alias.
using reference = value_type&
(Key, Value) pair reference alias.
using const_reference = const value_type&
(Key, Value) pair const reference alias.
using pointer = value_type*
(Key, Value) pair pointer alias.
using const_pointer = const value_type*
(Key, Value) pair const pointer alias.

Constructors, destructors, conversion operators

unordered_map()
Default constructor.
unordered_map(const unordered_map& other)
Copy constructor.
unordered_map(unordered_map&& other) noexcept
Move constructor.
unordered_map(const iunordered_map<Key, Value, KeyHash, KeyEqual>& other)
Copy constructor.
unordered_map(iunordered_map<Key, Value, KeyHash, KeyEqual>&& other) noexcept
Move constructor.

Public functions

auto operator=(const unordered_map& other) -> unordered_map&
Copy assignment operator.
auto operator=(unordered_map&& other) -> unordered_map& noexcept
Move assignment operator.
auto operator=(const iunordered_map<Key, Value, KeyHash, KeyEqual>& other) -> unordered_map&
Copy assignment operator.
auto operator=(iunordered_map<Key, Value, KeyHash, KeyEqual>&& other) -> unordered_map& noexcept
Move assignment operator.

Function documentation

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::unordered_map(const unordered_map& other)

Copy constructor.

Parameters
other unordered_map to copy.

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::unordered_map(unordered_map&& other) noexcept

Move constructor.

Parameters
other unordered_map to move.

Unlike std::unordered_map, it doesn't offer pointer stability.

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::unordered_map(const iunordered_map<Key, Value, KeyHash, KeyEqual>& other)

Copy constructor.

Parameters
other iunordered_map to copy.

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::unordered_map(iunordered_map<Key, Value, KeyHash, KeyEqual>&& other) noexcept

Move constructor.

Parameters
other iunordered_map to move.

Unlike std::unordered_map, it doesn't offer pointer stability.

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_map& bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::operator=(const unordered_map& other)

Copy assignment operator.

Parameters
other unordered_map to copy.
Returns Reference to this.

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_map& bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::operator=(unordered_map&& other) noexcept

Move assignment operator.

Parameters
other unordered_map to move.
Returns Reference to this.

Unlike std::unordered_map, it doesn't offer pointer stability.

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_map& bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::operator=(const iunordered_map<Key, Value, KeyHash, KeyEqual>& other)

Copy assignment operator.

Parameters
other iunordered_map to copy.
Returns Reference to this.

template<typename Key, typename Value, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_map& bn::unordered_map<Key, Value, MaxSize, KeyHash, KeyEqual>::operator=(iunordered_map<Key, Value, KeyHash, KeyEqual>&& other) noexcept

Move assignment operator.

Parameters
other iunordered_map to move.
Returns Reference to this.

Unlike std::unordered_map, it doesn't offer pointer stability.