nfx-containers 0.6.0
Modern C++20 header-only library providing high-performance hash containers with Robin Hood and perfect hashing
Loading...
Searching...
No Matches
nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator Class Referencefinal

Const forward iterator for PerfectHashMap. More...

#include <nfx/containers/PerfectHashMap.h>

Public Types

using iterator_category = std::forward_iterator_tag
 STL iterator category (forward iterator).
using value_type = std::pair<TKey, TValue>
 STL iterator value type (key-value pair).
using difference_type = std::ptrdiff_t
 STL iterator difference type.
using pointer = const value_type*
 STL iterator pointer type (const).
using reference = const value_type&
 STL iterator reference type (const).

Public Member Functions

 Iterator (const std::vector< std::optional< std::pair< TKey, TValue > > > *table, size_t index)
 Construct iterator from table pointers and index.
reference operator* () const
 Dereference operator to access key-value pair.
pointer operator-> () const
 Arrow operator to access key-value pair members.
Iteratoroperator++ ()
 Pre-increment operator to advance to next occupied slot.
Iterator operator++ (int)
 Post-increment operator to advance to next occupied slot.
bool operator== (const Iterator &other) const
 Equality comparison operator.
bool operator!= (const Iterator &other) const
 Inequality comparison operator.

Detailed Description

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
class nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator

Const forward iterator for PerfectHashMap.

Iterates over occupied slots in the hash table, skipping empty slots. Since PerfectHashMap is immutable, Iterator is always const.

Definition at line 331 of file PerfectHashMap.h.

Member Typedef Documentation

◆ difference_type

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
using nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::difference_type = std::ptrdiff_t

STL iterator difference type.

Definition at line 341 of file PerfectHashMap.h.

◆ iterator_category

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
using nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::iterator_category = std::forward_iterator_tag

STL iterator category (forward iterator).

Definition at line 335 of file PerfectHashMap.h.

◆ pointer

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
using nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::pointer = const value_type*

STL iterator pointer type (const).

Definition at line 344 of file PerfectHashMap.h.

◆ reference

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
using nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::reference = const value_type&

STL iterator reference type (const).

Definition at line 347 of file PerfectHashMap.h.

◆ value_type

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
using nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::value_type = std::pair<TKey, TValue>

STL iterator value type (key-value pair).

Definition at line 338 of file PerfectHashMap.h.

Constructor & Destructor Documentation

◆ Iterator()

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::Iterator ( const std::vector< std::optional< std::pair< TKey, TValue > > > * table,
size_t index )
inline

Construct iterator from table pointers and index.

Parameters
tablePointer to the hash table storage
indexStarting index in the table

Member Function Documentation

◆ operator!=()

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
bool nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::operator!= ( const Iterator & other) const
inline

Inequality comparison operator.

Parameters
otherIterator to compare with
Returns
true if iterators point to different positions

◆ operator*()

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
reference nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::operator* ( ) const
inline

Dereference operator to access key-value pair.

Returns
Const reference to current key-value pair

◆ operator++() [1/2]

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
Iterator & nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::operator++ ( )
inline

Pre-increment operator to advance to next occupied slot.

Returns
Reference to this iterator after advancement

◆ operator++() [2/2]

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
Iterator nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::operator++ ( int )
inline

Post-increment operator to advance to next occupied slot.

Returns
Copy of iterator before advancement

◆ operator->()

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
pointer nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::operator-> ( ) const
inline

Arrow operator to access key-value pair members.

Returns
Const pointer to current key-value pair

◆ operator==()

template<typename TKey, typename TValue, hashing::Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? hashing::constants::FNV_OFFSET_BASIS_32 : hashing::constants::FNV_OFFSET_BASIS_64 ), typename Hasher = hashing::Hasher<HashType, Seed>, typename KeyEqual = std::equal_to<>>
bool nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::Iterator::operator== ( const Iterator & other) const
inline

Equality comparison operator.

Parameters
otherIterator to compare with
Returns
true if iterators point to the same position

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