Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
UnorderedMap< Key, Value, Hash, KeyEqual > Class Template Reference

#include <UnorderedMap.h>

Inheritance diagram for UnorderedMap< Key, Value, Hash, KeyEqual >:
HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >

Public Types

using size_type = typename Base::size_type
 
using iterator = typename Base::iterator
 
using const_iterator = typename Base::const_iterator
 
using value_type = typename Base::value_type
 
- Public Types inherited from HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >
using value_type = KeyValue
 Properties.
 
using size_type = uint32
 
using difference_type = ptrdiff_t
 

Public Member Functions

Value & operator[] (const Key &inKey)
 
template<class... Args>
std::pair< iterator, bool > try_emplace (const Key &inKey, Args &&...inArgs)
 
template<class... Args>
std::pair< iterator, bool > try_emplace (Key &&inKey, Args &&...inArgs)
 
iterator find (const Key &inKey)
 Non-const version of find.
 
const_iterator find (const Key &inKey) const
 Const version of find.
 
- Public Member Functions inherited from HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >
 HashTable ()=default
 Default constructor.
 
 HashTable (const HashTable &inRHS)
 Copy constructor.
 
 HashTable (HashTable &&ioRHS) noexcept
 Move constructor.
 
HashTableoperator= (const HashTable &inRHS)
 Assignment operator.
 
HashTableoperator= (HashTable &&ioRHS) noexcept
 Move assignment operator.
 
 ~HashTable ()
 Destructor.
 
void reserve (size_type inMaxSize)
 Reserve memory for a certain number of elements.
 
void clear ()
 Destroy the entire hash table.
 
void ClearAndKeepMemory ()
 Destroy the entire hash table but keeps the memory allocated.
 
iterator begin ()
 Iterator to first element.
 
iterator end ()
 Iterator to one beyond last element.
 
const_iterator begin () const
 Iterator to first element.
 
const_iterator end () const
 Iterator to one beyond last element.
 
const_iterator cbegin () const
 Iterator to first element.
 
const_iterator cend () const
 Iterator to one beyond last element.
 
size_type bucket_count () const
 Number of buckets in the table.
 
constexpr size_type max_bucket_count () const
 Max number of buckets that the table can have.
 
bool empty () const
 Check if there are no elements in the table.
 
size_type size () const
 Number of elements in the table.
 
constexpr size_type max_size () const
 Max number of elements that the table can hold.
 
constexpr float max_load_factor () const
 Get the max load factor for this table (max number of elements / number of buckets)
 
std::pair< iterator, bool > insert (const value_type &inValue)
 Insert a new element, returns iterator and if the element was inserted.
 
const_iterator find (const Key &inKey) const
 Find an element, returns iterator to element or end() if not found.
 
void erase (const const_iterator &inIterator)
 Erase an element by iterator.
 
size_type erase (const Key &inKey)
 Erase an element by key.
 
void swap (HashTable &ioRHS) noexcept
 Swap the contents of two hash tables.
 
void rehash (size_type)
 

Additional Inherited Members

- Protected Member Functions inherited from HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >
KeyValue & GetElement (size_type inIndex) const
 Get an element by index.
 
template<bool InsertAfterGrow = false>
bool InsertKey (const Key &inKey, size_type &outIndex)
 

Detailed Description

template<class Key, class Value, class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
class UnorderedMap< Key, Value, Hash, KeyEqual >

Hash Map class

Template Parameters
KeyKey type
ValueValue type
HashHash function (note should be 64-bits)
KeyEqualEquality comparison function

Member Typedef Documentation

◆ const_iterator

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
using UnorderedMap< Key, Value, Hash, KeyEqual >::const_iterator = typename Base::const_iterator

◆ iterator

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
using UnorderedMap< Key, Value, Hash, KeyEqual >::iterator = typename Base::iterator

◆ size_type

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
using UnorderedMap< Key, Value, Hash, KeyEqual >::size_type = typename Base::size_type

◆ value_type

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
using UnorderedMap< Key, Value, Hash, KeyEqual >::value_type = typename Base::value_type

Member Function Documentation

◆ find() [1/2]

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
iterator UnorderedMap< Key, Value, Hash, KeyEqual >::find ( const Key &  inKey)
inline

Non-const version of find.

◆ find() [2/2]

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
const_iterator HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >::find ( const Key &  inKey) const
inline

Const version of find.

◆ operator[]()

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
Value & UnorderedMap< Key, Value, Hash, KeyEqual >::operator[] ( const Key &  inKey)
inline

◆ try_emplace() [1/2]

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
template<class... Args>
std::pair< iterator, bool > UnorderedMap< Key, Value, Hash, KeyEqual >::try_emplace ( const Key &  inKey,
Args &&...  inArgs 
)
inline

◆ try_emplace() [2/2]

template<class Key , class Value , class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
template<class... Args>
std::pair< iterator, bool > UnorderedMap< Key, Value, Hash, KeyEqual >::try_emplace ( Key &&  inKey,
Args &&...  inArgs 
)
inline

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