This is a space efficient container that mimics the TfHashMap API that uses a vector for storage when the size of the map is small. More...
Public Types | |
typedef std::pair< const Key, Data > | value_type |
typedef Key | key_type |
typedef Data | mapped_type |
typedef _IteratorBase < value_type, typename _Vector::iterator > | iterator |
An iterator type for this map. More... | |
typedef _IteratorBase< const value_type, typename _Vector::const_iterator > | const_iterator |
An iterator type for this map. More... | |
typedef std::pair< iterator, bool > | insert_result |
Return type for insert() method. More... | |
Public Member Functions | |
TfDenseHashMap (const HashFn &hashFn=HashFn(), const EqualKey &equalKey=EqualKey()) | |
Ctor. More... | |
template<class Iterator > | |
TfDenseHashMap (Iterator begin, Iterator end) | |
Construct with range. More... | |
TfDenseHashMap (std::initializer_list< value_type > l) | |
Construct from an initializer_list. More... | |
TfDenseHashMap (const TfDenseHashMap &rhs) | |
Copy Ctor. More... | |
TfDenseHashMap (TfDenseHashMap &&rhs)=default | |
Move Ctor. More... | |
TfDenseHashMap & | operator= (const TfDenseHashMap &rhs) |
Copy assignment operator. More... | |
TfDenseHashMap & | operator= (TfDenseHashMap &&rhs)=default |
Move assignment operator. More... | |
TfDenseHashMap & | operator= (std::initializer_list< value_type > l) |
Assignment from an initializer_list. More... | |
bool | operator== (const TfDenseHashMap &rhs) const |
Equality operator. More... | |
bool | operator!= (const TfDenseHashMap &rhs) const |
void | clear () |
Erases all of the elements. More... | |
void | swap (TfDenseHashMap &rhs) |
Swaps the contents of two maps. More... | |
bool | empty () const |
true if the map's size is 0. More... | |
size_t | size () const |
Returns the size of the map. More... | |
iterator | begin () |
Returns an const_iterator pointing to the beginning of the map. More... | |
iterator | end () |
Returns an const_iterator pointing to the end of the map. More... | |
const_iterator | begin () const |
Returns an const_iterator pointing to the beginning of the map. More... | |
const_iterator | end () const |
Returns an const_iterator pointing to the end of the map. More... | |
iterator | find (const key_type &k) |
Finds the element with key k . More... | |
const_iterator | find (const key_type &k) const |
Finds the element with key k . More... | |
size_t | count (const key_type &k) const |
Returns the number of elements with key k . More... | |
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. More... | |
template<class IteratorType > | |
void | insert (IteratorType i0, IteratorType i1) |
Insert a range into the hash map. More... | |
template<class Iterator > | |
void | insert_unique (Iterator begin, Iterator end) |
Insert a range of unique elements into the container. More... | |
Data & | operator[] (const key_type &key) |
Indexing operator. More... | |
size_t | erase (const key_type &k) |
Erase element with key k . More... | |
void | erase (const iterator &iter) |
Erases element pointed to by iter . More... | |
void | erase (iterator i0, iterator i1) |
Erases a range from the map. More... | |
void | shrink_to_fit () |
Optimize storage space. More... | |
void | reserve (size_t n) |
Reserve space. More... | |
This is a space efficient container that mimics the TfHashMap API that uses a vector for storage when the size of the map is small.
When the map gets bigger than Threshold
a TfHashMap is allocated that is used to accelerate lookup in the vector.
Definition at line 59 of file denseHashMap.h.
typedef _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 211 of file denseHashMap.h.
typedef std::pair<iterator, bool> insert_result |
Return type for insert() method.
Definition at line 214 of file denseHashMap.h.
typedef _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 205 of file denseHashMap.h.
|
inlineexplicit |
Ctor.
Definition at line 220 of file denseHashMap.h.
|
inline |
Construct with range.
Definition at line 231 of file denseHashMap.h.
|
inline |
Construct from an initializer_list.
Definition at line 237 of file denseHashMap.h.
|
inline |
Copy Ctor.
Definition at line 243 of file denseHashMap.h.
|
default |
Move Ctor.
|
inline |
Returns an const_iterator pointing to the beginning of the map.
Definition at line 329 of file denseHashMap.h.
|
inline |
Returns an const_iterator pointing to the beginning of the map.
Definition at line 341 of file denseHashMap.h.
|
inline |
Erases all of the elements.
Definition at line 303 of file denseHashMap.h.
|
inline |
Returns the number of elements with key k
.
Which is either 0 or 1.
Definition at line 381 of file denseHashMap.h.
|
inline |
true
if the map's
size is 0.
Definition at line 317 of file denseHashMap.h.
|
inline |
Returns an const_iterator pointing to the end of the map.
Definition at line 335 of file denseHashMap.h.
|
inline |
Returns an const_iterator pointing to the end of the map.
Definition at line 347 of file denseHashMap.h.
|
inline |
Erase element with key k
.
Returns the number of elements erased.
Definition at line 454 of file denseHashMap.h.
|
inline |
Erases element pointed to by iter
.
Definition at line 466 of file denseHashMap.h.
Erases a range from the map.
Definition at line 492 of file denseHashMap.h.
|
inline |
Finds the element with key k
.
Definition at line 353 of file denseHashMap.h.
|
inline |
Finds the element with key k
.
Definition at line 367 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 388 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 415 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 432 of file denseHashMap.h.
|
inline |
Copy assignment operator.
Definition at line 256 of file denseHashMap.h.
|
default |
Move assignment operator.
|
inline |
Assignment from an initializer_list.
Definition at line 270 of file denseHashMap.h.
|
inline |
Equality operator.
Definition at line 278 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 448 of file denseHashMap.h.
|
inline |
Reserve space.
Definition at line 536 of file denseHashMap.h.
|
inline |
Optimize storage space.
Definition at line 510 of file denseHashMap.h.
|
inline |
Returns the size of the map.
Definition at line 323 of file denseHashMap.h.
|
inline |
Swaps the contents of two maps.
Definition at line 310 of file denseHashMap.h.