![]() |
AireEngine
A 3D Open-World Game Engine
|
#include <hashSet.h>
Classes | |
| struct | ConstIterator |
| Iterator to iterate through the elements of a const HashSet. More... | |
| struct | Iterator |
| Iterator to iterate through the elements of a non-const HashSet. More... | |
Public Member Functions | |
| HashSet (int sizeHint=10) | |
| bool | insert (const T &newElement) |
| void | erase (const T &element) |
| void | clear () |
| void | freeMem () |
| void | reserve (size_t count) |
| Iterator | find (const T &element) |
| ConstIterator | find (const T &newElement) const |
| bool | empty () const |
| size_t | size () const |
| size_t | capacity () const |
| Iterator | begin () |
| ConstIterator | begin () const |
| Iterator | end () |
| ConstIterator | end () const |
A hash set data structure that maintains an unordered set of unique elements. Supports constant time insertion and deletion AND fast traversal.
However, iterators are invalidated on element deletion, i.e. deleting elements during traversal will lead to incorrect results.
Deletion involves member swap, so it is not advisable to store large objects.
Use this structure when fast traversal of hash set elements is required. If traversal of the whole set is not a priority, it is better to use std::unordered_set.
|
inline |
|
inline |
|
inline |
|
inline |
Clear the HashSet. It becomes empty (contains no elements) but the allocated memory persists.
|
inline |
|
inline |
|
inline |
Remove an element from the HashSet.
| element | Element to delete. |
|
inline |
|
inline |
Clear the contents of the HashSet and release any heap memory that was allocated by the containers used.

Insert a new element in the HashSet.
| newElement | Element to insert. |
Reserve memory to hold a given number of elements. Does nothing if allocated memory is larger.
| count | The number of elements that memory should be able to fit. |
|
inline |