template<typename Key, int MaxSize, typename KeyHash, typename KeyEqual>
bn::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

template<typename Key, typename KeyHash, typename KeyEqual>
class iunordered_set<Key, KeyHash, KeyEqual>
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_set to copy.

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_set to move.

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_set to copy.

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_set to move.

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_set to copy.
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_set to move.
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_set to copy.
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_set to move.
Returns Reference to this.

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