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 > Class Template Referencefinal

Perfect hash map using displacement-based perfect hashing for immutable datasets. More...

#include <nfx/containers/PerfectHashMap.h>

Classes

class  Iterator
 Const forward iterator for PerfectHashMap. More...

Public Types

using key_type = TKey
 Type alias for key type.
using mapped_type = TValue
 Type alias for mapped value type.
using value_type = std::pair<TKey, TValue>
 Type alias for key-value pair type.
using hasher = Hasher
 Type alias for hasher type.
using key_equal = KeyEqual
 Type alias for key equality comparator.
using hash_type = HashType
 Type alias for hash type (uint32_t or uint64_t).
using seed_type = std::make_signed_t<hash_type>
 Type alias for signed seed type (used internally for displacement seeds).
using size_type = size_t
 Type alias for size type.
using difference_type = std::ptrdiff_t
 Type alias for difference type.
using iterator = Iterator
 Primary iterator class.
using const_iterator = Iterator
 Type alias for const iterator (same as iterator since map is immutable).
using ConstIterator = Iterator
 Alias for const iterator.

Public Member Functions

 PerfectHashMap (std::vector< std::pair< TKey, TValue > > &&items)
 Constructs a perfect hash map from a vector of key-value pairs.
 PerfectHashMap ()=default
 Default constructor creates an empty map.
 PerfectHashMap (const PerfectHashMap &)=default
 Copy constructor.
 PerfectHashMap (PerfectHashMap &&) noexcept=default
 Move constructor.
 ~PerfectHashMap ()=default
 Destructor.
PerfectHashMapoperator= (const PerfectHashMap &)=default
 Copy assignment operator.
PerfectHashMapoperator= (PerfectHashMap &&) noexcept=default
 Move assignment operator.
bool operator== (const PerfectHashMap &other) const noexcept
 Equality comparison operator.
bool operator!= (const PerfectHashMap &other) const noexcept
 Inequality comparison operator.
template<typename K>
const TValue & at (const K &key) const
 Access element with bounds checking.
template<typename K>
bool contains (const K &key) const noexcept
 Check if a key exists in the map.
template<typename K>
const TValue * find (const K &key) const noexcept
 Fast lookup with heterogeneous key types (C++ idiom: pointer return).
size_type size () const noexcept
 Get the total size of the hash table.
size_type count () const noexcept
 Get the number of elements in the map.
bool isEmpty () const noexcept
 Check if the map is empty.
Iterator begin () const noexcept
 Get iterator to beginning of occupied slots.
Iterator end () const noexcept
 Get iterator to end (past last occupied slot).
ConstIterator cbegin () const noexcept
 Get const iterator to beginning of occupied slots (explicit const).
ConstIterator cend () const noexcept
 Get const iterator to end (explicit const).
hasher hash_function () const
 Get the hash function object.
key_equal key_eq () const
 Get the key equality comparison function object.

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 >

Perfect hash map using displacement-based perfect hashing for immutable datasets.

Template Parameters
TKeyKey type (supports heterogeneous lookup for compatible types)
TValueMapped value type
HashTypeHash type - either uint32_t or uint64_t (default: uint32_t)
SeedHash seed value for initialization (default: FNV offset basis for HashType)
HasherHash functor type (default: hashing::Hasher<HashType, Seed>)
KeyEqualKey equality comparator (default: std::equal_to<> for transparent comparison)

Provides O(1) guaranteed lookups with zero collision overhead using displacement-based perfect hashing. The algorithm creates a perfect hash function where each key maps to a unique table position with no collisions, enabling true constant-time lookups.

Construction uses bucket-based displacement with seed mixing to resolve collisions:

  • Keys are distributed into buckets by their hash value
  • Buckets are processed largest-first to minimize displacement attempts
  • Each multi-item bucket finds a unique seed that displaces items to empty slots
  • Single-item buckets are placed directly without displacement

Memory overhead: Table size is 2x the number of keys for efficient seed finding. This trade-off provides guaranteed O(1) lookups with simple, maintainable code.

Note
The map is immutable after construction. Use HashMap for mutable scenarios.

Definition at line 85 of file PerfectHashMap.h.

Member Typedef Documentation

◆ const_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<>>
using nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::const_iterator = Iterator

Type alias for const iterator (same as iterator since map is immutable).

Definition at line 129 of file PerfectHashMap.h.

◆ ConstIterator

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 >::ConstIterator = Iterator

Alias for const iterator.

Definition at line 132 of file PerfectHashMap.h.

◆ 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 >::difference_type = std::ptrdiff_t

Type alias for difference type.

Definition at line 123 of file PerfectHashMap.h.

◆ hash_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 >::hash_type = HashType

Type alias for hash type (uint32_t or uint64_t).

Definition at line 114 of file PerfectHashMap.h.

◆ hasher

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 >::hasher = Hasher

Type alias for hasher type.

Definition at line 108 of file PerfectHashMap.h.

◆ 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<>>
using nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::iterator = Iterator

Primary iterator class.

Definition at line 126 of file PerfectHashMap.h.

◆ key_equal

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 >::key_equal = KeyEqual

Type alias for key equality comparator.

Definition at line 111 of file PerfectHashMap.h.

◆ key_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 >::key_type = TKey

Type alias for key type.

Definition at line 99 of file PerfectHashMap.h.

◆ mapped_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 >::mapped_type = TValue

Type alias for mapped value type.

Definition at line 102 of file PerfectHashMap.h.

◆ seed_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 >::seed_type = std::make_signed_t<hash_type>

Type alias for signed seed type (used internally for displacement seeds).

Definition at line 117 of file PerfectHashMap.h.

◆ size_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 >::size_type = size_t

Type alias for size type.

Definition at line 120 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 >::value_type = std::pair<TKey, TValue>

Type alias for key-value pair type.

Definition at line 105 of file PerfectHashMap.h.

Constructor & Destructor Documentation

◆ PerfectHashMap() [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<>>
nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::PerfectHashMap ( std::vector< std::pair< TKey, TValue > > && items)
inlineexplicit

Constructs a perfect hash map from a vector of key-value pairs.

Parameters
itemsVector of key-value pairs (moved into the map)
Exceptions
std::invalid_argumentif duplicate keys are detected in items

Uses displacement-based perfect hashing to build a collision-free hash table. Construction is O(n) expected time. The resulting map is immutable.

◆ PerfectHashMap() [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<>>
nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::PerfectHashMap ( )
default

Default constructor creates an empty map.

Creates an empty PerfectHashMap with no elements. Use the explicit constructor with a vector of key-value pairs to build a functional perfect hash map.

Member Function Documentation

◆ at()

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<>>
template<typename K>
const TValue & nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::at ( const K & key) const
inline

Access element with bounds checking.

Template Parameters
KKey type (supports heterogeneous lookup for compatible types)
Parameters
keyThe key to search for
Returns
Const reference to the mapped value
Exceptions
std::out_of_rangeif key is not found in the map

Provides checked access to elements. For unchecked access, use find(). Supports heterogeneous lookup (e.g., string_view for string keys).

◆ begin()

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 >::begin ( ) const
inlinenodiscardnoexcept

Get iterator to beginning of occupied slots.

Returns
Iterator pointing to first key-value pair
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ cbegin()

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<>>
ConstIterator nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::cbegin ( ) const
inlinenodiscardnoexcept

Get const iterator to beginning of occupied slots (explicit const).

Returns
Const iterator pointing to first key-value pair
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ cend()

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<>>
ConstIterator nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::cend ( ) const
inlinenodiscardnoexcept

Get const iterator to end (explicit const).

Returns
Const iterator pointing past the last key-value pair
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ contains()

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<>>
template<typename K>
bool nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::contains ( const K & key) const
inlinenodiscardnoexcept

Check if a key exists in the map.

Template Parameters
KKey type (supports heterogeneous lookup for compatible types)
Parameters
keyThe key to search for
Returns
true if key exists in the map, false otherwise

O(1) guaranteed lookup time using perfect hashing. Supports heterogeneous lookup (e.g., string_view for string keys).

Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ count()

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<>>
size_type nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::count ( ) const
inlinenodiscardnoexcept

Get the number of elements in the map.

Returns
Number of key-value pairs stored in the map
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ end()

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 >::end ( ) const
inlinenodiscardnoexcept

Get iterator to end (past last occupied slot).

Returns
Iterator pointing past the last key-value pair
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ find()

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<>>
template<typename K>
const TValue * nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::find ( const K & key) const
inlinenodiscardnoexcept

Fast lookup with heterogeneous key types (C++ idiom: pointer return).

Template Parameters
KKey type (supports heterogeneous lookup for compatible types)
Parameters
keyThe key to search for
Returns
Pointer to the value if found, nullptr otherwise
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ hash_function()

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<>>
hasher nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::hash_function ( ) const
inline

Get the hash function object.

Returns
Copy of the hash function used by the map

◆ isEmpty()

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 >::isEmpty ( ) const
inlinenodiscardnoexcept

Check if the map is empty.

Returns
true if size() == 0, false otherwise
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ key_eq()

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<>>
key_equal nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::key_eq ( ) const
inline

Get the key equality comparison function object.

Returns
Copy of the key equality comparator used by the map

◆ 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 >::operator!= ( const PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual > & other) const
inlinenodiscardnoexcept

Inequality comparison operator.

Parameters
otherPerfectHashMap to compare with
Returns
true if maps differ in size or contents, false otherwise

◆ 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<>>
PerfectHashMap & nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::operator= ( const PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual > & )
default

Copy assignment operator.

Returns
Reference to this map

◆ 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<>>
PerfectHashMap & nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::operator= ( PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual > && )
defaultnoexcept

Move assignment operator.

Returns
Reference to this map

◆ 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 >::operator== ( const PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual > & other) const
inlinenodiscardnoexcept

Equality comparison operator.

Parameters
otherPerfectHashMap to compare with
Returns
true if both maps contain the same key-value pairs, false otherwise

◆ size()

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<>>
size_type nfx::containers::PerfectHashMap< TKey, TValue, HashType, Seed, Hasher, KeyEqual >::size ( ) const
inlinenodiscardnoexcept

Get the total size of the hash table.

Returns
Total number of slots in the hash table (including empty slots)
Note
This function is marked [[nodiscard]] - the return value should not be ignored

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