emilib
|
A cache-friendly hash set with open addressing, linear probing and power-of-two capacity. More...
#include <hash_set.hpp>
Classes | |
class | const_iterator |
class | iterator |
Public Types | |
using | size_type = size_t |
using | value_type = KeyT |
using | reference = KeyT & |
using | const_reference = const KeyT & |
Public Member Functions | |
HashSet (const HashSet &other) | |
HashSet (HashSet &&other) | |
HashSet & | operator= (const HashSet &other) |
void | operator= (HashSet &&other) |
void | swap (HashSet &other) |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
size_t | size () const |
bool | empty () const |
size_t | bucket_count () 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 |
std::pair< iterator, bool > | insert (const KeyT &key) |
std::pair< iterator, bool > | insert (KeyT &&key) |
template<class... Args> | |
std::pair< iterator, bool > | emplace (Args &&... args) |
void | insert (const_iterator begin, const_iterator end) |
void | insert_unique (KeyT key) |
Same as above, but contains(key) MUST be false. | |
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. | |
A cache-friendly hash set with open addressing, linear probing and power-of-two capacity.
|
inline |
Erase an element from the hash set. return false if element was not found.
|
inline |
Erase an element using an iterator. Returns an iterator to the next element (or end()).
|
inline |
Insert an element, unless it already exists. Returns a pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.
|
inline |
Insert an element, unless it already exists. Returns a pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.