|
HDK
|
#include <UT_ArrayMap.h>
Inheritance diagram for UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >:Classes | |
| struct | deref_pair_first |
| struct | deref_pair_second |
| class | ordered_iterator_t |
| class | partial_iterator_base |
Public Types | |
| typedef ArraySet< std::pair < Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T > , MapKeyEqual< KeyEqual, Key, T > > | set_type |
| typedef ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > | map_type |
| typedef Key | key_type |
| typedef T | mapped_type |
| typedef Hash | hasher |
| typedef KeyEqual | key_equal |
| using | pointer = typename set_type::pointer |
| using | const_pointer = typename set_type::const_pointer |
| using | value_type = typename set_type::value_type |
| using | size_type = typename set_type::size_type |
| using | iterator = typename set_type::iterator |
| Inherit iterator and const_iterator. More... | |
| template<bool constant_type> | |
| using | iterator_t = typename set_type::template iterator_t< constant_type > |
| using | const_iterator = typename set_type::const_iterator |
| using | const_key_iterator = partial_iterator_base< const_iterator, const key_type, deref_pair_first< const_iterator, const key_type >> |
| using | mapped_iterator = partial_iterator_base< iterator, mapped_type, deref_pair_second< iterator, mapped_type >> |
| using | const_mapped_iterator = partial_iterator_base< const_iterator, const mapped_type, deref_pair_second< const_iterator, const mapped_type >> |
| typedef ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > | set_type |
| Inherit the constructors from ArraySet. More... | |
Public Types inherited from UT::ArraySet< std::pair< Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T >, MapKeyEqual< KeyEqual, Key, T > > | |
| typedef ArraySet< std::pair < Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T > , MapKeyEqual< KeyEqual, Key, T > > | set_type |
| typedef std::pair< Key, T > | key_type |
| typedef std::pair< Key, T > | value_type |
| typedef std::size_t | size_type |
| typedef std::ptrdiff_t | difference_type |
| typedef MapKeyHash< Hash, Key, T > | hasher |
| typedef MapKeyEqual< KeyEqual, Key, T > | key_equal |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef Clearer | clearer_type |
| typedef iterator_t< false > | iterator |
| Iterator type for iterating over non-constant elements. More... | |
Public Member Functions | |
| std::pair< iterator, bool > | insert (const Key &key, const T &val) |
| std::pair< iterator, bool > | insert (Key &&key, T &&val) |
| bool | operator== (const map_type &that) const |
| bool | operator!= (const map_type &that) const |
| mapped_type | get (const key_type &key, const mapped_type &defval) const |
| size_type | count (const Key &key) const |
| bool | contains (const Key &key) const |
| T & | operator[] (const Key &key) |
| T & | operator[] (Key &&key) |
| size_type | erase (const Key &key) |
| template<typename FUNCTOR > | |
| SYS_FORCE_INLINE void | forEachKey (FUNCTOR &&functor) const |
| template<typename FUNCTOR > | |
| SYS_FORCE_INLINE void | forEachValue (FUNCTOR &&functor) const |
| template<typename COMPARATOR > | |
| ordered_iterator_t< true > | ordered_begin (const COMPARATOR &comparator) const |
| template<typename COMPARATOR > | |
| ordered_iterator_t< true > | ordered_cbegin (const COMPARATOR &comparator) const |
| template<typename COMPARATOR > | |
| ordered_iterator_t< false > | ordered_begin (const COMPARATOR &comparator) |
| UT_IteratorRange < const_key_iterator > | key_range () const |
| UT_IteratorRange< mapped_iterator > | mapped_range () |
| UT_IteratorRange < const_mapped_iterator > | mapped_range () const |
| iterator | find (const Key &key) |
| const_iterator | find (const Key &key) const |
| T & | at (const Key &key) |
| const T & | at (const Key &key) const |
| std::pair< const_iterator, const_iterator > | equal_range (const Key &key) const |
| std::pair< iterator, iterator > | equal_range (const Key &key) |
Public Member Functions inherited from UT::ArraySet< std::pair< Key, T >, MULTI, MAX_LOAD_FACTOR_256, Clearer, MapKeyHash< Hash, Key, T >, MapKeyEqual< KeyEqual, Key, T > > | |
| ArraySet () | |
| ArraySet (size_type init_bucket_count) | |
| ArraySet (set_type &&that) | |
| Move constructor, destroying the source. More... | |
| ArraySet (const set_type &that) | |
| ArraySet (INPUT_ITERATOR start_input, INPUT_ITERATOR end_input, size_type init_bucket_count=0) | |
| Inserts all of the items in the range [start_input,end_input). More... | |
| ArraySet (std::initializer_list< value_type > init, size_type init_bucket_count=0) | |
| set_type & | operator= (const set_type &that) |
| set_type & | operator= (std::initializer_list< value_type > init) |
| set_type & | operator= (set_type &&that) |
| bool | operator== (const set_type &that) const |
| bool | operator!= (const set_type &that) const |
| void | swap (set_type &that) |
| Swaps another set with this one. More... | |
| ~ArraySet () | |
| bool | empty () const |
| Returns true iff there are no items in the set. More... | |
| size_type | size () const |
| Returns the number of items in the set. More... | |
| void | clear () |
| void | destroy () |
| Removes all items from the set and frees all the memory. More... | |
| size_type | bucket_count () const |
| Returns the current number of buckets. More... | |
| size_type | bucket_size (size_type i) const |
| float | load_factor () const |
| Returns the current portion of buckets that are occupied. More... | |
| void | rehash (size_type new_num_buckets) |
| void | reserve (size_type num_items) |
| void | setNumBuckets (size_type new_num_buckets) |
| void | bumpNumBuckets (size_type new_num_items) |
| iterator | begin () |
| Returns a non-const iterator for the beginning of the set. More... | |
| const_iterator | begin () const |
| Returns a const iterator for the beginning of the set. More... | |
| const_iterator | cbegin () const |
| Returns a const iterator for the beginning of the set. More... | |
| iterator | end () |
| Returns a non-const end iterator for the set. More... | |
| const_iterator | end () const |
| Returns a const end iterator for the set. More... | |
| const_iterator | cend () const |
| Returns a const end iterator for the set. More... | |
| size_type | count (const std::pair< Key, T > &key) const |
| bool | contains (const std::pair< Key, T > &key) const |
| bool | containsAll (const S &src) const |
| void | insert (INPUT_ITERATOR start_input, INPUT_ITERATOR end_input) |
| Inserts all of the items in the range [start_input,end_input). More... | |
| void | insert (std::initializer_list< value_type > list) |
| Inserts all of the items from the initializer_list. More... | |
| std::pair< iterator, bool > | emplace (Args &&...args) |
| iterator | erase (iterator iter) |
| size_type | erase (const std::pair< Key, T > &key) |
| int64 | getMemoryUsage (bool inclusive) const |
| SYS_FORCE_INLINE void | forEach (FUNCTOR &&functor) const |
| iterator | find (const std::pair< Key, T > &key) |
| const_iterator | find (const std::pair< Key, T > &key) const |
| std::pair< const_iterator, const_iterator > | equal_range (const std::pair< Key, T > &key) const |
| std::pair< iterator, iterator > | equal_range (const std::pair< Key, T > &key) |
| std::pair< iterator, bool > | insert (const value_type &value) |
| std::pair< iterator, bool > | insert (value_type &&value) |
This is close to a drop-in replacement for std::unordered_map, except that it uses a single array of items and empty spaces marked with a dedicated "clear" value. It also has a fixed maximum load factor, and doesn't store a hasher, comparator, or allocator object as member data, avoiding unnecessary overhead, but these differences introduce some interface incompatibilities.
See the comment on UT::ArraySet for specifics on these interface incompatibilities. Most functions are inherited from UT::ArraySet.
Definition at line 85 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::const_iterator = typename set_type::const_iterator |
Definition at line 106 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::const_key_iterator = partial_iterator_base<const_iterator, const key_type, deref_pair_first<const_iterator, const key_type>> |
Definition at line 743 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::const_mapped_iterator = partial_iterator_base<const_iterator, const mapped_type, deref_pair_second<const_iterator, const mapped_type>> |
Definition at line 747 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::const_pointer = typename set_type::const_pointer |
Definition at line 98 of file UT_ArrayMap.h.
| typedef Hash UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::hasher |
Definition at line 92 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::iterator = typename set_type::iterator |
Inherit iterator and const_iterator.
Definition at line 103 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::iterator_t = typename set_type::template iterator_t<constant_type> |
Definition at line 105 of file UT_ArrayMap.h.
| typedef KeyEqual UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::key_equal |
Definition at line 93 of file UT_ArrayMap.h.
| typedef Key UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::key_type |
Definition at line 90 of file UT_ArrayMap.h.
| typedef ArrayMap<Key,T,MULTI,MAX_LOAD_FACTOR_256,Clearer,Hash,KeyEqual> UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::map_type |
Definition at line 89 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::mapped_iterator = partial_iterator_base<iterator, mapped_type, deref_pair_second<iterator, mapped_type>> |
Definition at line 745 of file UT_ArrayMap.h.
| typedef T UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::mapped_type |
Definition at line 91 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::pointer = typename set_type::pointer |
GCC and Clang can't find base class members in templated code, so we need to declare explicitly that we're inheriting them.
Definition at line 97 of file UT_ArrayMap.h.
| typedef ArraySet<std::pair<Key,T>,MULTI,MAX_LOAD_FACTOR_256,Clearer,MapKeyHash<Hash,Key,T>,MapKeyEqual<KeyEqual,Key,T> > UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::set_type |
Definition at line 88 of file UT_ArrayMap.h.
| typedef ArraySet<Key,MULTI,MAX_LOAD_FACTOR_256,Clearer,Hash,KeyEqual> UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::set_type |
Inherit the constructors from ArraySet.
Definition at line 230 of file UT_ArraySet.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::size_type = typename set_type::size_type |
Definition at line 100 of file UT_ArrayMap.h.
| using UT::ArrayMap< Key, T, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual >::value_type = typename set_type::value_type |
Definition at line 99 of file UT_ArrayMap.h.
|
inline |
Returns a reference to the value of the first item matching key. WARNING: This throws an exception if nothing matches key!
Definition at line 232 of file UT_ArrayMap.h.
|
inline |
Returns a reference to the value of the first item matching key. WARNING: This throws an exception if nothing matches key!
Definition at line 269 of file UT_ArrayMap.h.
|
inline |
Returns true iff the set contains the given key. This should be faster than count() if MULTI is true.
Definition at line 347 of file UT_ArrayMap.h.
|
inline |
Returns the number of entries matching key. If MULTI is false, this will only return either 0 or 1.
Definition at line 308 of file UT_ArrayMap.h.
|
inline |
Returns a pair of iterators representing the range of values matching key, as [first,second).
Definition at line 426 of file UT_ArrayMap.h.
|
inline |
Returns a pair of iterators representing the range of values matching key, as [first,second).
Definition at line 491 of file UT_ArrayMap.h.
|
inline |
Removes all items matching key and returns the number of items removed.
Definition at line 563 of file UT_ArrayMap.h.
|
inline |
Returns an iterator to the first item matching key, or an end iterator if no items match key.
Definition at line 158 of file UT_ArrayMap.h.
|
inline |
Returns an iterator to the first item matching key, or an end iterator if no items match key.
Definition at line 186 of file UT_ArrayMap.h.
|
inline |
Definition at line 591 of file UT_ArrayMap.h.
|
inline |
Definition at line 604 of file UT_ArrayMap.h.
|
inline |
Returns the value at the key if it exists, or the provided default value if it does not. NOTE: Considering making this return const V&? Don't. Lifetime extension rules likely can't be used to make that safe. eg. const Foo &foo = get(key, Foo()) will return a stale reference.
Definition at line 221 of file UT_ArrayMap.h.
|
inline |
Definition at line 117 of file UT_ArrayMap.h.
|
inline |
Definition at line 121 of file UT_ArrayMap.h.
|
inline |
Returns a const range object that iterates over the map but returns only the key values. Example:
Definition at line 757 of file UT_ArrayMap.h.
|
inline |
Returns a range object that iterates over the map but returns only the mapped values.
Definition at line 763 of file UT_ArrayMap.h.
|
inline |
Returns a const range object that iterates over the map but returns only the mapped values.
Definition at line 769 of file UT_ArrayMap.h.
|
inline |
Definition at line 150 of file UT_ArrayMap.h.
|
inline |
Definition at line 127 of file UT_ArrayMap.h.
|
inline |
Returns a reference to the first value that is mapped-to from a key matching key, inserting if none exist. NOTE: If you use this, key cannot match the key of a pair cleared by Clearer, else insertHelper will assert.
Definition at line 379 of file UT_ArrayMap.h.
|
inline |
Returns a reference to the first value that is mapped-to from a key matching key, inserting if none exist. NOTE: If you use this, key cannot match the key of a pair cleared by Clearer, else insertHelper will assert.
Definition at line 403 of file UT_ArrayMap.h.
|
inline |
Definition at line 673 of file UT_ArrayMap.h.
|
inline |
Definition at line 685 of file UT_ArrayMap.h.
|
inline |
Definition at line 679 of file UT_ArrayMap.h.