|
| HashMap () |
| Construct empty.
|
|
| HashMap (const HashMap< T, U > &map) |
| Construct from another hash map.
|
|
| HashMap (HashMap< T, U > &&map) noexcept |
| Move-construct from another hash map.
|
|
| HashMap (const std::initializer_list< Pair< T, U >> &list) |
| Aggregate initialization constructor.
|
|
| ~HashMap () |
| Destruct.
|
|
HashMap & | operator= (const HashMap< T, U > &rhs) |
| Assign a hash map.
|
|
HashMap & | operator= (HashMap< T, U > &&rhs) noexcept |
| Move-assign a hash map.
|
|
HashMap & | operator+= (const Pair< T, U > &rhs) |
| Add-assign a pair.
|
|
HashMap & | operator+= (const HashMap< T, U > &rhs) |
| Add-assign a hash map.
|
|
bool | operator== (const HashMap< T, U > &rhs) const |
| Test for equality with another hash map.
|
|
bool | operator!= (const HashMap< T, U > &rhs) const |
| Test for inequality with another hash map.
|
|
U & | operator[] (const T &key) |
| Index the map. Create a new pair if key not found.
|
|
U * | operator[] (const T &key) const |
| Index the map. Return null if key is not found, does not create a new pair.
|
|
HashMap & | Populate (const T &key, const U &value) |
| Populate the map using variadic template. This handles the base case.
|
|
template<typename... Args> |
HashMap & | Populate (const T &key, const U &value, const Args &... args) |
| Populate the map using variadic template.
|
|
Iterator | Insert (const Pair< T, U > &pair) |
| Insert a pair. Return an iterator to it.
|
|
Iterator | Insert (const Pair< T, U > &pair, bool &exists) |
| Insert a pair. Return iterator and set exists flag according to whether the key already existed.
|
|
void | Insert (const HashMap< T, U > &map) |
| Insert a map.
|
|
Iterator | Insert (const ConstIterator &it) |
| Insert a pair by iterator. Return iterator to the value.
|
|
void | Insert (const ConstIterator &start, const ConstIterator &end) |
| Insert a range by iterators.
|
|
bool | Erase (const T &key) |
| Erase a pair by key. Return true if was found.
|
|
Iterator | Erase (const Iterator &it) |
| Erase a pair by iterator. Return iterator to the next pair.
|
|
void | Clear () |
| Clear the map.
|
|
void | Sort () |
| Sort pairs. After sorting the map can be iterated in order until new elements are inserted.
|
|
bool | Rehash (unsigned numBuckets) |
| Rehash to a specific bucket count, which must be a power of two. Return true if successful.
|
|
Iterator | Find (const T &key) |
| Return iterator to the pair with key, or end iterator if not found.
|
|
ConstIterator | Find (const T &key) const |
| Return const iterator to the pair with key, or end iterator if not found.
|
|
bool | Contains (const T &key) const |
| Return whether contains a pair with key.
|
|
bool | TryGetValue (const T &key, U &out) const |
| Try to copy value to output. Return true if was found.
|
|
Vector< T > | Keys () const |
| Return all the keys.
|
|
Vector< U > | Values () const |
| Return all the values.
|
|
Iterator | Begin () |
| Return iterator to the beginning.
|
|
ConstIterator | Begin () const |
| Return iterator to the beginning.
|
|
Iterator | End () |
| Return iterator to the end.
|
|
ConstIterator | End () const |
| Return iterator to the end.
|
|
const KeyValue & | Front () const |
| Return first pair.
|
|
const KeyValue & | Back () const |
| Return last pair.
|
|
| HashBase () |
| Construct.
|
|
void | Swap (HashBase &rhs) |
| Swap with another hash set or map.
|
|
unsigned | Size () const |
| Return number of elements.
|
|
unsigned | NumBuckets () const |
| Return number of buckets.
|
|
bool | IsEmpty () const |
| Return whether has no elements.
|
|
|
Node * | Head () const |
| Return the head node.
|
|
Node * | Tail () const |
| Return the tail node.
|
|
Node * | FindNode (const T &key, unsigned hashKey) const |
| Find a node from the buckets. Do not call if the buckets have not been allocated.
|
|
Node * | FindNode (const T &key, unsigned hashKey, Node *&previous) const |
| Find a node and the previous node from the buckets. Do not call if the buckets have not been allocated.
|
|
Node * | InsertNode (const T &key, const U &value, bool findExisting=true) |
| Insert a key and value and return either the new or existing node.
|
|
Node * | InsertNode (Node *dest, const T &key, const U &value) |
| Insert a node into the list. Return the new node.
|
|
Node * | EraseNode (Node *node) |
| Erase a node from the list. Return pointer to the next element, or to the end if could not erase.
|
|
Node * | ReserveNode () |
| Reserve a node.
|
|
Node * | ReserveNode (const T &key, const U &value) |
| Reserve a node with specified key and value.
|
|
void | FreeNode (Node *node) |
| Free a node.
|
|
void | Rehash () |
| Rehash the buckets.
|
|
unsigned | Hash (const T &key) const |
| Compute a hash based on the key and the bucket size.
|
|