![]() |
nCine 2022.04.r504-20bd01e
A cross-platform 2D game engine
|
A template based hashset implementation with open addressing and leapfrog probing (version with static allocation) More...
#include <StaticHashSet.h>
Public Types | |
using | Iterator = StaticHashSetIterator< K, HashFunc, Capacity > |
Iterator type. | |
using | ConstIterator = StaticHashSetIterator< K, HashFunc, Capacity > |
Constant iterator type. | |
using | ReverseIterator = nctl::ReverseIterator< Iterator > |
Reverse iterator type. | |
using | ConstReverseIterator = nctl::ReverseIterator< ConstIterator > |
Reverse constant iterator type. | |
Public Member Functions | |
StaticHashSet (const StaticHashSet &other) | |
Copy constructor. | |
StaticHashSet (StaticHashSet &&other) | |
Move constructor. | |
StaticHashSet & | operator= (const StaticHashSet &other) |
Aassignment operator. | |
StaticHashSet & | operator= (StaticHashSet &&other) |
Move aassignment operator. | |
Iterator | begin () |
Returns an iterator to the first element. | |
ReverseIterator | rBegin () |
Returns a reverse iterator to the last element. | |
Iterator | end () |
Returns an iterator to past the last element. | |
ReverseIterator | rEnd () |
Returns a reverse iterator to prior the first element. | |
ConstIterator | begin () const |
Returns a constant iterator to the first element. | |
ConstReverseIterator | rBegin () const |
Returns a constant reverse iterator to the last element. | |
ConstIterator | end () const |
Returns a constant iterator to past the last lement. | |
ConstReverseIterator | rEnd () const |
Returns a constant reverse iterator to prior the first element. | |
ConstIterator | cBegin () const |
Returns a constant iterator to the first element. | |
ConstReverseIterator | crBegin () const |
Returns a constant reverse iterator to the last element. | |
ConstIterator | cEnd () const |
Returns a constant iterator to past the last lement. | |
ConstReverseIterator | crEnd () const |
Returns a constant reverse iterator to prior the first element. | |
bool | insert (const K &key) |
Inserts an element if not already in. | |
bool | insert (K &&key) |
Moves an element if not already in. | |
unsigned int | capacity () const |
Returns the capacity of the hashset. | |
bool | isEmpty () const |
Returns true if the hashset is empty. | |
unsigned int | size () const |
Returns the number of elements in the hashset. | |
float | loadFactor () const |
Returns the ratio between used and total buckets. | |
hash_t | hash (const K &key) const |
Returns the hash of a given key. | |
void | clear () |
Clears the hashset. | |
bool | contains (const K &key) const |
Checks whether an element is in the hashset or not. | |
K * | find (const K &key) |
Checks whether an element is in the hashset or not. | |
const K * | find (const K &key) const |
Checks whether an element is in the hashset or not (read-only) | |
bool | remove (const K &key) |
Removes a key from the hashset, if it exists. | |
Friends | |
class | StaticHashSetIterator< K, HashFunc, Capacity > |
struct | StaticHashSetHelperTraits< K, HashFunc, Capacity > |
A template based hashset implementation with open addressing and leapfrog probing (version with static allocation)
K * nctl::StaticHashSet< K, Capacity, HashFunc >::find | ( | const K & | key | ) |
Checks whether an element is in the hashset or not.
T
is expensive, but always check the validity of returned pointer. const K * nctl::StaticHashSet< K, Capacity, HashFunc >::find | ( | const K & | key | ) | const |
Checks whether an element is in the hashset or not (read-only)
T
is expensive, but always check the validity of returned pointer. bool nctl::StaticHashSet< K, Capacity, HashFunc >::insert | ( | const K & | key | ) |
Inserts an element if not already in.
bool nctl::StaticHashSet< K, Capacity, HashFunc >::insert | ( | K && | key | ) |
Moves an element if not already in.
bool nctl::StaticHashSet< K, Capacity, HashFunc >::remove | ( | const K & | key | ) |
Removes a key from the hashset, if it exists.