This module provides an implementation of a set data structure by means of a hash table.

class HashSet(Element) if (isImmutable!(Element)): Set!(Element);

The HashSet class template implements a set using a hash table.

this(Element[] elements...);

Constructs a new HashSet containing the specified elements.

Templatise to support an array of implicitly convertible elements, once issue 435 is fixed.
const bool opIn_r(Element elem);
void add(Element elem);

Adds elem to the set.

As of DMD 2.058, it is possible to add a mutable object of a subclass of Element's set (issue 3731).
void remove(Element elem);
void removeCurrent();

Removes the element currently active in the innermost active foreach loop on this set.

A foreach loop must be active on this set.
The removal doesn't take effect until the iteration of the foreach loop exits. A nested foreach loop on the same set must not be started after removeCurrent before the end of the iteration, since this is likely to cause the wrong element to be removed. There is also potential undefined behaviour if the same set is iterated through a mutable reference and, nested within this loop, through a const or immutable reference.
Future Directions:
This method may be superseded by something more robust.
const Element storedKey(Element elem);
const size_t length();
const HashSet dup();
const immutable(HashSet) idup();
const Element[] data();
int opApply(int delegate(ref Element) dg);
const int opApply(int delegate(ref Element) dg);
const HashSet opAnd(const(Set) s);


const HashSet opOr(const(Set) s);
const HashSet opSub(const(Set) s);
const HashSet opAnd(bool delegate(Element) dg);
const HashSet opSub(bool delegate(Element) dg);
const HashSet opXor(const(Set) s);
HashSet opAndAssign(const(Set) s);
HashSet opOrAssign(const(Set) s);
HashSet opSubAssign(const(Set) s);
HashSet opXorAssign(const(Set) s);
HashSet opAndAssign(bool delegate(Element) dg);
HashSet opSubAssign(bool delegate(Element) dg);
HashSet rehash();

Rehashes the set in place.