HashSet

Hash table implementation of a Set

Iterator iterator ()
int opApply (int delegate(ref V value) dg)

bool add (V element)
bool contains (V element)
bool take (ref V element)
bool remove (V element)
size_t remove (IContainer!(V) e)
bool replace (V oldElement, V newElement)

size_t size ()
bool isEmpty ()
V[] toArray (V[] dst)
HashSet dup ()
HashSet clear ()
HashSet reset ()

size_t buckets ()
void buckets (size_t cap)
float threshold ()
void threshold (float desired)

Constructors

this
this(float f)

Construct a HashSet instance

Destructor

~this
~this()

Clean up when deleted

Members

Aliases

Type
alias Type = Slink!(V)
Undocumented in source.

Functions

add
bool add(V element)

Add a new element to the set. Does not add if there is an equivalent already present. Returns true where an element is added, false where it already exists

add
void add(IContainer!(V) e)
buckets
size_t buckets()

Return the number of buckets

buckets
HashSet buckets(size_t cap)

Set the number of buckets and resize as required

cache
HashSet cache(size_t chunk, size_t count)

Configure the assigned allocator with the size of each allocation block (number of nodes allocated at one time) and the number of nodes to pre-populate the cache with.

check
HashSet check()

Sanity check

clear
HashSet clear()

Clears the HashMap contents. Various attributes are retained, such as the internal table itself. Invoke reset() to drop everything.

contains
bool contains(V element)

Does this set contain the given element?

dup
HashSet dup()

Make an independent copy of the container. Does not clone elements

isEmpty
bool isEmpty()

Is this container empty?

iterator
Iterator iterator()

Return a generic iterator for contained elements

opApply
int opApply(int delegate(ref V value) dg)
remove
size_t remove(V element, bool all)

Remove the provided element. Returns true if found, false otherwise

remove
bool remove(V element)

Remove the provided element. Returns true if found, false otherwise

remove
size_t remove(IContainer!(V) e)
replace
size_t replace(V oldElement, V newElement, bool all)

Replace the first instance of oldElement with newElement. Returns true if oldElement was found and replaced, false otherwise.

replace
bool replace(V oldElement, V newElement)

Replace the first instance of oldElement with newElement. Returns true if oldElement was found and replaced, false otherwise.

reset
HashSet reset()

Reset the HashSet contents and optionally configure a new heap manager. This releases more memory than clear() does

size
size_t size()

Return the number of elements contained

take
bool take(V element)

Remove and expose the first element. Returns false when no more elements are contained

threshold
float threshold()

Return the resize threshold

threshold
void threshold(float desired)

Set the resize threshold, and resize as required

toArray
V[] toArray(V[] dst)

Copy and return the contained set of values in an array, using the optional dst as a recipient (which is resized as necessary).

Meta