13template <
class Key,
class Value>
18 static const Key &
sGetKey(
const std::pair<Key, Value> &inKeyValue)
20 return inKeyValue.first;
29template <
class Key,
class Value,
class Hash,
class KeyEqual>
30class UnorderedMap :
public HashTable<Key, std::pair<Key, Value>, UnorderedMapDetail<Key, Value>, Hash, KeyEqual>
43 bool inserted = this->
InsertKey(inKey, index);
47 return key_value.second;
50 template<
class... Args>
51 std::pair<iterator, bool>
try_emplace(
const Key &inKey, Args &&...inArgs)
54 bool inserted = this->
InsertKey(inKey, index);
56 new (&this->
GetElement(index))
value_type(std::piecewise_construct, std::forward_as_tuple(inKey), std::forward_as_tuple(std::forward<Args>(inArgs)...));
57 return std::make_pair(
iterator(
this, index), inserted);
60 template<
class... Args>
61 std::pair<iterator, bool>
try_emplace(Key &&inKey, Args &&...inArgs)
64 bool inserted = this->
InsertKey(inKey, index);
66 new (&this->
GetElement(index))
value_type(std::piecewise_construct, std::forward_as_tuple(std::move(inKey)), std::forward_as_tuple(std::forward<Args>(inArgs)...));
67 return std::make_pair(
iterator(
this, index), inserted);
#define JPH_NAMESPACE_END
Definition Core.h:425
#define JPH_NAMESPACE_BEGIN
Definition Core.h:419
Definition HashTable.h:16
std::pair< Key, Value > & GetElement(size_type inIndex) const
Definition HashTable.h:225
const_iterator find(const Key &inKey) const
Definition HashTable.h:631
std::pair< Key, Value > value_type
Definition HashTable.h:19
bool InsertKey(const Key &inKey, size_type &outIndex)
Definition HashTable.h:233
uint32 size_type
Definition HashTable.h:20
Internal helper class to provide context for UnorderedMap.
Definition UnorderedMap.h:15
static const Key & sGetKey(const std::pair< Key, Value > &inKeyValue)
Get key from key value pair.
Definition UnorderedMap.h:18
Definition UnorderedMap.h:31
typename Base::const_iterator const_iterator
Definition UnorderedMap.h:37
Value & operator[](const Key &inKey)
Definition UnorderedMap.h:40
typename Base::value_type value_type
Definition UnorderedMap.h:38
std::pair< iterator, bool > try_emplace(const Key &inKey, Args &&...inArgs)
Definition UnorderedMap.h:51
iterator find(const Key &inKey)
Non-const version of find.
Definition UnorderedMap.h:74
std::pair< iterator, bool > try_emplace(Key &&inKey, Args &&...inArgs)
Definition UnorderedMap.h:61
typename Base::size_type size_type
Definition UnorderedMap.h:35
typename Base::iterator iterator
Definition UnorderedMap.h:36
Fallback hash function that calls T::GetHash()
Definition HashCombine.h:59