![]() |
|
This is a space efficient container that mimics the TfHashSet API that uses a vector for storage when the size of the set is small. More...
#include <denseHashSet.h>
Public Types | |
| typedef Element | value_type |
| typedef _Vector::const_iterator | iterator |
| An iterator type for this set. | |
| typedef _Vector::const_iterator | const_iterator |
| A const_iterator type for this set. | |
| typedef std::pair< const_iterator, bool > | insert_result |
| Return type for insert() method. | |
Public Member Functions | |
| TfDenseHashSet (const HashFn &hashFn=HashFn(), const EqualElement &equalElement=EqualElement()) | |
| Ctor. | |
| TfDenseHashSet (const TfDenseHashSet &rhs) | |
| Copy Ctor. | |
| TfDenseHashSet (TfDenseHashSet &&rhs)=default | |
| Move Ctor. | |
| template<class Iterator > | |
| TfDenseHashSet (Iterator begin, Iterator end) | |
| Construct from range. | |
| TfDenseHashSet (std::initializer_list< Element > l) | |
| Construct from an initializer_list. | |
| TfDenseHashSet & | operator= (const TfDenseHashSet &rhs) |
| Copy assignment operator. | |
| TfDenseHashSet & | operator= (TfDenseHashSet &&rhs)=default |
| Move assignment operator. | |
| TfDenseHashSet & | operator= (std::initializer_list< Element > l) |
| Assignment from an initializer_list. | |
| bool | operator== (const TfDenseHashSet &rhs) const |
| Equality operator. | |
| bool | operator!= (const TfDenseHashSet &rhs) const |
| void | clear () |
| Erases all of the elements. | |
| void | swap (TfDenseHashSet &rhs) |
| Swaps the contents of two sets. | |
| bool | empty () const |
true if the set's size is 0. | |
| size_t | size () const |
| Returns the size of the set. | |
| const_iterator | begin () const |
| Returns an const_iterator pointing to the beginning of the set. | |
| const_iterator | end () const |
| Returns an const_iterator pointing to the end of the set. | |
| const_iterator | find (const Element &k) const |
Finds the element with key k. | |
| size_t | count (const Element &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 set. | |
| template<class Iterator > | |
| void | insert_unique (Iterator begin, Iterator end) |
| Insert a range of unique elements into the container. | |
| size_t | erase (const Element &k) |
Erase element with key k. | |
| void | erase (const iterator &iter) |
Erases element pointed to by iter. | |
| void | erase (const iterator &i0, const iterator &i1) |
| Erases a range from the set. | |
| void | shrink_to_fit () |
| Optimize storage space. | |
| const Element & | operator[] (size_t index) const |
Index into set via index. | |
This is a space efficient container that mimics the TfHashSet API that uses a vector for storage when the size of the set is small.
When the set gets bigger than Threshold a TfHashMap is allocated that is used to accelerate lookup in the vector.
Definition at line 38 of file denseHashSet.h.
| typedef _Vector::const_iterator const_iterator |
A const_iterator type for this set.
Definition at line 64 of file denseHashSet.h.
| typedef std::pair<const_iterator, bool> insert_result |
Return type for insert() method.
Definition at line 67 of file denseHashSet.h.
| typedef _Vector::const_iterator iterator |
An iterator type for this set.
Note that this one is const as well, as we can't allow in-place modification of elements due to the potentially allocated hash map.
Definition at line 61 of file denseHashSet.h.
| typedef Element value_type |
Definition at line 42 of file denseHashSet.h.
|
inlineexplicit |
Ctor.
Definition at line 73 of file denseHashSet.h.
|
inline |
Copy Ctor.
Definition at line 83 of file denseHashSet.h.
|
default |
Move Ctor.
|
inline |
Construct from range.
Definition at line 97 of file denseHashSet.h.
|
inline |
Construct from an initializer_list.
Definition at line 103 of file denseHashSet.h.
|
inline |
Returns an const_iterator pointing to the beginning of the set.
Definition at line 179 of file denseHashSet.h.
|
inline |
Erases all of the elements.
Definition at line 153 of file denseHashSet.h.
|
inline |
Returns the number of elements with key k.
Which is either 0 or 1.
Definition at line 212 of file denseHashSet.h.
|
inline |
true if the set's size is 0.
Definition at line 167 of file denseHashSet.h.
|
inline |
Returns an const_iterator pointing to the end of the set.
Definition at line 185 of file denseHashSet.h.
|
inline |
Erase element with key k.
Returns the number of elements erased.
Definition at line 281 of file denseHashSet.h.
Erases a range from the set.
Definition at line 318 of file denseHashSet.h.
|
inline |
Erases element pointed to by iter.
Definition at line 293 of file denseHashSet.h.
|
inline |
Finds the element with key k.
Definition at line 191 of file denseHashSet.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 219 of file denseHashSet.h.
|
inline |
Insert a range into the hash set.
Note that i0 and i1 can't point into the hash set.
Definition at line 251 of file denseHashSet.h.
|
inline |
Insert a range of unique elements into the container.
[begin, end) must not contain any duplicate elements.
Definition at line 268 of file denseHashSet.h.
|
inline |
Definition at line 147 of file denseHashSet.h.
|
inline |
Copy assignment operator.
Definition at line 109 of file denseHashSet.h.
|
inline |
Assignment from an initializer_list.
Definition at line 123 of file denseHashSet.h.
|
default |
Move assignment operator.
|
inline |
Equality operator.
Definition at line 131 of file denseHashSet.h.
|
inline |
Index into set via index.
Definition at line 361 of file denseHashSet.h.
|
inline |
Optimize storage space.
Definition at line 335 of file denseHashSet.h.
|
inline |
Returns the size of the set.
Definition at line 173 of file denseHashSet.h.
|
inline |
Swaps the contents of two sets.
Definition at line 160 of file denseHashSet.h.