#include <bn_unordered_map.h>
template<typename Key, typename Value, int MaxSize, typename KeyHash = hash<Key>, typename KeyEqual = equal_ to<Key>>
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_class iunordered_map<Key, Value, hash<Key>, equal_to<Key>>
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_ |
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_ |
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_ |
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_ |
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_ |
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_ |
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_ |
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_ |
Returns | Reference to this. |
Unlike std::unordered_map
, it doesn't offer pointer stability.