![]() |
|
A hash map with contiguous storage, suitable for use with TfSpan, e.g. More...
#include <denseHashMap.h>
Public Types | |
| using | key_type = Key |
| using | mapped_type = Data |
| using | value_type = std::pair<const Key, Data> |
| using | pointer = value_type* |
| using | const_pointer = const value_type* |
| typedef _IteratorBase< value_type, typename _Vector::iterator > | iterator |
| An iterator type for this map. | |
| typedef _IteratorBase< const value_type, typename _Vector::const_iterator > | const_iterator |
| An iterator type for this map. | |
| typedef std::pair< iterator, bool > | insert_result |
| Return type for insert() method. | |
Public Member Functions | |
| TfDenseHashMap (const HashFn &hashFn=HashFn(), const EqualKey &equalKey=EqualKey()) | |
| Ctor. | |
| template<class Iterator > | |
| TfDenseHashMap (Iterator begin, Iterator end) | |
| Construct with range. | |
| TfDenseHashMap (std::initializer_list< value_type > l) | |
| Construct from an initializer_list. | |
| TfDenseHashMap (const TfDenseHashMap &rhs) | |
| Copy Ctor. | |
| TfDenseHashMap (TfDenseHashMap &&rhs)=default | |
| Move Ctor. | |
| TfDenseHashMap & | operator= (const TfDenseHashMap &rhs) |
| Copy assignment operator. | |
| TfDenseHashMap & | operator= (TfDenseHashMap &&rhs)=default |
| Move assignment operator. | |
| TfDenseHashMap & | operator= (std::initializer_list< value_type > l) |
| Assignment from an initializer_list. | |
| bool | operator== (const TfDenseHashMap &rhs) const |
| Equality operator. | |
| bool | operator!= (const TfDenseHashMap &rhs) const |
| void | clear () |
| Erases all of the elements. | |
| void | swap (TfDenseHashMap &rhs) |
| Swaps the contents of two maps. | |
| bool | empty () const |
true if the map's size is 0. | |
| size_t | size () const |
| Returns the size of the map. | |
| iterator | begin () |
| Returns an iterator pointing to the beginning of the map. | |
| iterator | end () |
| Returns an iterator pointing to the end of the map. | |
| const_iterator | begin () const |
| Returns a const_iterator pointing to the beginning of the map. | |
| const_iterator | end () const |
| Returns a const_iterator pointing to the end of the map. | |
| const_iterator | cbegin () const |
| Returns a const_iterator pointing to the beginning of the map. | |
| const_iterator | cend () const |
| Returns a const_iterator pointing to the end of the map. | |
| pointer | data () |
| Returns a pointer to the map's data. | |
| const_pointer | data () const |
| Returns a const pointer to the map's data. | |
| const_pointer | cdata () const |
| Returns a const pointer to the map's data. | |
| iterator | find (const key_type &k) |
Finds the element with key k. | |
| const_iterator | find (const key_type &k) const |
Finds the element with key k. | |
| size_t | count (const key_type &k) const |
Returns the number of elements with key k. | |
| insert_result | insert (const value_type &v) |
| Returns a pair of <iterator, bool> where iterator points to the element in the list and bool is true if a new element was inserted. | |
| template<class IteratorType > | |
| void | insert (IteratorType i0, IteratorType i1) |
| Insert a range into the hash map. | |
| template<class Iterator > | |
| void | insert_unique (Iterator begin, Iterator end) |
| Insert a range of unique elements into the container. | |
| Data & | operator[] (const key_type &key) |
| Indexing operator. | |
| size_t | erase (const key_type &k) |
Erase element with key k. | |
| void | erase (const iterator &iter) |
Erases element pointed to by iter. | |
| void | erase (iterator i0, iterator i1) |
| Erases a range from the map. | |
| void | shrink_to_fit () |
| Optimize storage space. | |
| void | reserve (size_t n) |
| Reserve space. | |
A hash map with contiguous storage, suitable for use with TfSpan, e.g.
When the number of elements in the map is small, search operations are done by linear search. When the size surpassees Threshold, a hash table is allocated and used to accelerate lookup.
Definition at line 42 of file denseHashMap.h.
| _IteratorBase<const value_type, typename _Vector::const_iterator> const_iterator |
An iterator type for this map.
Note that it provides access to the This::value_type only.
Definition at line 231 of file denseHashMap.h.
| using const_pointer = const value_type* |
Definition at line 50 of file denseHashMap.h.
| std::pair<iterator, bool> insert_result |
Return type for insert() method.
Definition at line 234 of file denseHashMap.h.
| _IteratorBase<value_type, typename _Vector::iterator> iterator |
An iterator type for this map.
Note that it provides access to the This::value_type only.
Definition at line 225 of file denseHashMap.h.
| using key_type = Key |
Definition at line 46 of file denseHashMap.h.
| using mapped_type = Data |
Definition at line 47 of file denseHashMap.h.
| using pointer = value_type* |
Definition at line 49 of file denseHashMap.h.
| using value_type = std::pair<const Key, Data> |
Definition at line 48 of file denseHashMap.h.
|
inlineexplicit |
Ctor.
Definition at line 240 of file denseHashMap.h.
|
inline |
Construct with range.
Definition at line 251 of file denseHashMap.h.
|
inline |
Construct from an initializer_list.
Definition at line 257 of file denseHashMap.h.
|
inline |
Copy Ctor.
Definition at line 263 of file denseHashMap.h.
|
default |
Move Ctor.
|
inline |
Returns an iterator pointing to the beginning of the map.
Definition at line 348 of file denseHashMap.h.
|
inline |
Returns a const_iterator pointing to the beginning of the map.
Definition at line 360 of file denseHashMap.h.
|
inline |
Returns a const_iterator pointing to the beginning of the map.
Definition at line 372 of file denseHashMap.h.
|
inline |
Returns a const pointer to the map's data.
Definition at line 396 of file denseHashMap.h.
|
inline |
Returns a const_iterator pointing to the end of the map.
Definition at line 378 of file denseHashMap.h.
|
inline |
Erases all of the elements.
Definition at line 322 of file denseHashMap.h.
|
inline |
Returns the number of elements with key k.
Which is either 0 or 1.
Definition at line 430 of file denseHashMap.h.
|
inline |
Returns a pointer to the map's data.
Definition at line 384 of file denseHashMap.h.
|
inline |
Returns a const pointer to the map's data.
Definition at line 390 of file denseHashMap.h.
|
inline |
true if the map's size is 0.
Definition at line 336 of file denseHashMap.h.
|
inline |
Returns an iterator pointing to the end of the map.
Definition at line 354 of file denseHashMap.h.
|
inline |
Returns a const_iterator pointing to the end of the map.
Definition at line 366 of file denseHashMap.h.
|
inline |
Erases element pointed to by iter.
Definition at line 515 of file denseHashMap.h.
|
inline |
Erase element with key k.
Returns the number of elements erased.
Definition at line 503 of file denseHashMap.h.
|
inline |
Erases a range from the map.
Definition at line 541 of file denseHashMap.h.
|
inline |
Finds the element with key k.
Definition at line 402 of file denseHashMap.h.
|
inline |
Finds the element with key k.
Definition at line 416 of file denseHashMap.h.
|
inline |
Returns a pair of <iterator, bool> where iterator points to the element in the list and bool is true if a new element was inserted.
Definition at line 437 of file denseHashMap.h.
|
inline |
Insert a range into the hash map.
Note that i0 and i1 can't point into the hash map.
Definition at line 464 of file denseHashMap.h.
|
inline |
Insert a range of unique elements into the container.
[begin, end) must not contain any duplicate elements.
Definition at line 481 of file denseHashMap.h.
|
inline |
Definition at line 316 of file denseHashMap.h.
|
inline |
Copy assignment operator.
Definition at line 275 of file denseHashMap.h.
|
inline |
Assignment from an initializer_list.
Definition at line 289 of file denseHashMap.h.
|
default |
Move assignment operator.
|
inline |
Equality operator.
Definition at line 297 of file denseHashMap.h.
|
inline |
Indexing operator.
Inserts a default constructed DataType() for key if there is no value for key already.
Returns a reference to the value type for key.
Definition at line 497 of file denseHashMap.h.
|
inline |
Reserve space.
Definition at line 585 of file denseHashMap.h.
|
inline |
Optimize storage space.
Definition at line 559 of file denseHashMap.h.
|
inline |
Returns the size of the map.
Definition at line 342 of file denseHashMap.h.
|
inline |
Swaps the contents of two maps.
Definition at line 329 of file denseHashMap.h.