StormByte 3.0.0
C++26 foundation of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst > Class Template Referencefinal

Forward cursor over Base-owned hash nodes. More...

#include <StormByte/safe/unordered_map.hxx>

Public Types

using iterator_category = std::forward_iterator_tag
 Iterator category.
using iterator_concept = std::forward_iterator_tag
 C++20 iterator concept.
using value_type = UnorderedMap::value_type
 Entry type.
using difference_type = std::ptrdiff_t
 Iterator distance type.
using reference = std::conditional_t<IsConst, const value_type&, value_type&>
 Entry reference.
using pointer = std::conditional_t<IsConst, const value_type*, value_type*>
 Entry pointer.
using StormByteSafeCursor = void
 Base cursor mark. Copying the cursor copies one node pointer.

Public Member Functions

 BasicIterator () noexcept
 Construct a singular iterator.
template<bool OtherConst>
requires IsConst
&&!OtherConst BasicIterator (const BasicIterator< OtherConst > &other) noexcept
 Convert a mutable iterator to a const iterator.
reference operator* () const noexcept
 Return the entry stored in the node.
pointer operator-> () const noexcept
 Access the entry stored in the node.
BasicIterator & operator++ () noexcept
 Advance to the next occupied node, skipping empty buckets.
BasicIterator operator++ (int) noexcept
 Advance to the next occupied node, skipping empty buckets.
template<bool OtherConst>
bool operator== (const BasicIterator< OtherConst > &other) const noexcept
 Compare node identity.

Friends

class UnorderedMap
template<bool>
class BasicIterator

Detailed Description

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
class StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >

Forward cursor over Base-owned hash nodes.

Template Parameters
IsConstWhether dereference is read-only.

The cursor stores one node pointer and the map. Copying it does not allocate and does not take ownership. Order is bucket order, not insertion order. Rehash invalidates every cursor.

Member Typedef Documentation

◆ difference_type

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
using StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::difference_type = std::ptrdiff_t

Iterator distance type.

◆ iterator_category

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
using StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::iterator_category = std::forward_iterator_tag

Iterator category.

◆ iterator_concept

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
using StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::iterator_concept = std::forward_iterator_tag

C++20 iterator concept.

◆ pointer

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
using StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::pointer = std::conditional_t<IsConst, const value_type*, value_type*>

Entry pointer.

◆ reference

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
using StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::reference = std::conditional_t<IsConst, const value_type&, value_type&>

Entry reference.

◆ StormByteSafeCursor

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
using StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::StormByteSafeCursor = void

Base cursor mark. Copying the cursor copies one node pointer.

◆ value_type

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
using StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::value_type = UnorderedMap::value_type

Entry type.

Constructor & Destructor Documentation

◆ BasicIterator() [1/2]

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::BasicIterator ( )
inlinenoexcept

Construct a singular iterator.

◆ BasicIterator() [2/2]

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
template<bool OtherConst>
requires IsConst
&&!OtherConst StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::BasicIterator ( const BasicIterator< OtherConst > & other)
inlinenoexcept

Convert a mutable iterator to a const iterator.

Parameters
otherMutable iterator.

Member Function Documentation

◆ operator*()

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
reference StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::operator* ( ) const
inlinenoexcept

Return the entry stored in the node.

Returns
Entry reference. Valid until the node is erased or the map is rehashed.

◆ operator++() [1/2]

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
BasicIterator & StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::operator++ ( )
noexcept

Advance to the next occupied node, skipping empty buckets.

Returns
This iterator.

◆ operator++() [2/2]

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
BasicIterator StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::operator++ ( int )
noexcept

Advance to the next occupied node, skipping empty buckets.

Returns
Previous iterator value.

◆ operator->()

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
pointer StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::operator-> ( ) const
inlinenoexcept

Access the entry stored in the node.

Returns
Entry pointer. Valid until the node is erased or the map is rehashed.

◆ operator==()

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
template<bool OtherConst>
bool StormByte::Safe::UnorderedMap< K, V, Hash, KeyEqual >::BasicIterator< IsConst >::operator== ( const BasicIterator< OtherConst > & other) const
inlinenoexcept

Compare node identity.

Parameters
otherIterator to compare.
Returns
Whether both designate the same node.

◆ BasicIterator

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
template<bool>
friend class BasicIterator
friend

◆ UnorderedMap

template<Type::SafeValue K, Type::SafeValue V, class Hash = Hash<K>, class KeyEqual = std::equal_to<K>>
template<bool IsConst>
friend class UnorderedMap
friend

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