#include <bn_unordered_set.h>
template<typename Key, int MaxSize, typename KeyHash = hash<Key>, typename KeyEqual = equal_ to<Key>>
unordered_set class
std::unordered_set
like container with a fixed size buffer.
Template parameters | |
---|---|
Key | Element 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_set
, it doesn't offer pointer stability when moving or erasing elements.
Base classes
- class iunordered_set<Key, hash<Key>, equal_to<Key>>
- Base class of bn::
unordered_set.
Public types
- using key_type = Key
- Key type alias.
- using value_type = Key
- Value 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& - Reference alias.
-
using const_reference = const value_
type& - Const reference alias.
-
using pointer = value_
type* - Pointer alias.
-
using const_pointer = const value_
type* - Const pointer alias.
Constructors, destructors, conversion operators
- unordered_set()
- Default constructor.
-
unordered_set(const unordered_
set& other) - Copy constructor.
-
unordered_set(unordered_
set&& other) noexcept - Move constructor.
-
unordered_set(const iunordered_
set<Key, KeyHash, KeyEqual>& other) - Copy constructor.
-
unordered_set(iunordered_
set<Key, KeyHash, KeyEqual>&& other) noexcept - Move constructor.
Public functions
-
auto operator=(const unordered_
set& other) -> unordered_ set& - Copy assignment operator.
-
auto operator=(unordered_
set&& other) -> unordered_ set& noexcept - Move assignment operator.
-
auto operator=(const iunordered_
set<Key, KeyHash, KeyEqual>& other) -> unordered_ set& - Copy assignment operator.
-
auto operator=(iunordered_
set<Key, KeyHash, KeyEqual>&& other) -> unordered_ set& noexcept - Move assignment operator.
Function documentation
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: unordered_set(const unordered_ set& other)
Copy constructor.
Parameters | |
---|---|
other | unordered_ |
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: unordered_set(unordered_ set&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | unordered_ |
Unlike std::unordered_set
, it doesn't offer pointer stability.
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: unordered_set(const iunordered_ set<Key, KeyHash, KeyEqual>& other)
Copy constructor.
Parameters | |
---|---|
other | iunordered_ |
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: unordered_set(iunordered_ set<Key, KeyHash, KeyEqual>&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | iunordered_ |
Unlike std::unordered_set
, it doesn't offer pointer stability.
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_ set& bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: operator=(const unordered_ set& other)
Copy assignment operator.
Parameters | |
---|---|
other | unordered_ |
Returns | Reference to this. |
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_ set& bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: operator=(unordered_ set&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | unordered_ |
Returns | Reference to this. |
Unlike std::unordered_set
, it doesn't offer pointer stability.
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_ set& bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: operator=(const iunordered_ set<Key, KeyHash, KeyEqual>& other)
Copy assignment operator.
Parameters | |
---|---|
other | iunordered_ |
Returns | Reference to this. |
template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
unordered_ set& bn:: unordered_set<Key, MaxSize, KeyHash, KeyEqual>:: operator=(iunordered_ set<Key, KeyHash, KeyEqual>&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | iunordered_ |
Returns | Reference to this. |
Unlike std::unordered_set
, it doesn't offer pointer stability.