containers.openhashset
Open-Addressed Hash Set
License
-
Declaration
structOpenHashSet(T, Allocator = Mallocator, alias hashFunction = generateHash!T, bool supportGC = shouldAddGCRange!T);Simple open-addressed hash set. Use this instead of HashSet when the size and quantity of the data to be inserted is small.
Parameters
Tthe element type of the hash set
Allocatorthe allocator to use. Defaults to
Mallocator.hashFunctionthe hash function to use
supportGCif
true, calls to GC.addRange and GC.removeRange will be used to ensure that the GC does not accidentally free memory owned by this container.-
Declaration
this(Allocatorallocator);Use the given
for allocations.allocator -
Declaration
this(size_tinitialCapacity, Allocatorallocator);Initializes the hash set with the given initial capacity.
Parameters
size_tinitialCapacitythe initial capacity for the hash set
-
Declaration
voidclear();Removes all items from the hash set.
-
Declaration
const pure nothrow @nogc @property @safe boolempty(); -
Declaration
const pure nothrow @nogc @property @safe size_tlength(); -
Declaration
const boolcontains(Titem);
inout boolopBinaryRight(string op)(Titem) if (op == "in");Return Value
trueif the hash setcontainsthe givenitem,falseotherwise. -
Declaration
boolinsert(Titem);
aliasput= insert;
aliasinsertAnywhere= insert;
boolopOpAssign(string op)(Titem) if (op == "~");Inserts the given
iteminto the set.Return Value
trueif theitemwas inserted,falseif it was already present. -
Declaration
boolremove(Titem);Parameters
Titemthe
itemtoremoveReturn Value
trueif theitemwas removed,falseif it was not present -
Declaration
pure nothrow @nogc @safe autoopSlice(this This)();Return Value
A range over the set.
-