#include <nCine/Base/StaticHashMapIterator.h>
template<class K, class T, class HashFunc, std:: uint32_t Capacity, bool IsConst>
StaticHashMapIterator class
Bidirectional iterator over the elements of a StaticHashMap.
Iterates over occupied buckets, skipping empty ones. The IsConst template parameter selects between a mutable and a read-only iterator.
Public types
- enum class SentinelTagInit { BEGINNING, END }
- Sentinel tag used to initialize the iterator before the first or past the last element.
- using Reference = typename IteratorTraits<StaticHashMapIterator>::Reference
- Reference type that respects the iterator constness.
Constructors, destructors, conversion operators
-
StaticHashMapIterator(typename StaticHashMapHelperTraits<K, T, HashFunc, Capacity, IsConst>::HashMapPtr hashMap,
std::
uint32_t bucketIndex) - StaticHashMapIterator(typename StaticHashMapHelperTraits<K, T, HashFunc, Capacity, IsConst>::HashMapPtr hashMap, SentinelTagInit tag)
- StaticHashMapIterator(const StaticHashMapIterator<K, T, HashFunc, Capacity, false>& it)
- Implicitly converts a non-constant iterator to a constant one.
Public functions
- auto operator*() const -> Reference
- Dereferences the iterator, returning the value of the pointed element.
- auto operator++() -> StaticHashMapIterator&
- Advances to the next element (prefix).
- auto operator++(int) -> StaticHashMapIterator
- Advances to the next element (postfix).
- auto operator--() -> StaticHashMapIterator&
- Moves to the previous element (prefix).
- auto operator--(int) -> StaticHashMapIterator
- Moves to the previous element (postfix).
- auto node() const -> StaticHashMapHelperTraits<K, T, HashFunc, Capacity, IsConst>::NodeReference
- Returns the hashmap node currently pointed to by the iterator.
- auto value() const -> const T&
- Returns the value of the currently pointed node.
- auto key() const -> const K&
- Returns the key of the currently pointed node.
-
auto hash() const -> hash_
t - Returns the hash of the currently pointed node.
Friends
- auto operator==(const StaticHashMapIterator& lhs, const StaticHashMapIterator& rhs) -> bool
- Returns
trueif both iterators point to the same element. - auto operator!=(const StaticHashMapIterator& lhs, const StaticHashMapIterator& rhs) -> bool
- Returns
trueif the iterators point to different elements.
Enum documentation
template<class K, class T, class HashFunc, std:: uint32_t Capacity, bool IsConst>
enum class nCine:: StaticHashMapIterator<K, T, HashFunc, Capacity, IsConst>:: SentinelTagInit
Sentinel tag used to initialize the iterator before the first or past the last element.
| Enumerators | |
|---|---|
| BEGINNING |
Iterator before the first element; the next element is the first one |
| END |
Iterator past the last element; the previous element is the last one |