A cache-friendly hash table with open addressing, linear probing and power-of-two capacity.
More...
|
| HashMap (const HashMap &other) |
|
| HashMap (HashMap &&other) |
|
HashMap & | operator= (const HashMap &other) |
|
void | operator= (HashMap &&other) |
|
void | swap (HashMap &other) |
|
iterator | begin () |
|
const_iterator | begin () const |
|
iterator | end () |
|
const_iterator | end () const |
|
size_t | size () const |
|
bool | empty () const |
|
iterator | find (const KeyT &key) |
|
const_iterator | find (const KeyT &key) const |
|
bool | contains (const KeyT &k) const |
|
size_t | count (const KeyT &k) const |
|
ValueT * | try_get (const KeyT &k) |
| Returns the matching ValueT or nullptr if k isn't found.
|
|
const ValueT * | try_get (const KeyT &k) const |
| Const version of the above.
|
|
const ValueT | get_or_return_default (const KeyT &k) const |
| Convenience function.
|
|
std::pair< iterator, bool > | insert (const KeyT &key, const ValueT &value) |
|
std::pair< iterator, bool > | insert (const std::pair< KeyT, ValueT > &p) |
|
void | insert (const_iterator begin, const_iterator end) |
|
void | insert_unique (KeyT &&key, ValueT &&value) |
| Same as above, but contains(key) MUST be false.
|
|
void | insert_unique (std::pair< KeyT, ValueT > &&p) |
|
ValueT | set_get (const KeyT &key, const ValueT &new_value) |
| Return the old value or ValueT() if it didn't exist.
|
|
ValueT & | operator[] (const KeyT &key) |
| Like std::map<KeyT,ValueT>::operator[].
|
|
bool | erase (const KeyT &key) |
|
iterator | erase (iterator it) |
|
void | clear () |
| Remove all elements, keeping full capacity.
|
|
void | reserve (size_t num_elems) |
| Make room for this many elements.
|
|
template<typename KeyT, typename ValueT, typename HashT = std::hash<KeyT>, typename EqT = HashMapEqualTo<KeyT>>
class emilib::HashMap< KeyT, ValueT, HashT, EqT >
A cache-friendly hash table with open addressing, linear probing and power-of-two capacity.