Set

Swiss tables hash set

Members

Aliases

SlotType
alias SlotType = T
Undocumented in source.

Functions

byKey
Range byKey()
insert
size_t insert(E value)

Insert a single element in the set.

insert
size_t insert(E values)

Insert a range of element in the set.

opApply
int opApply(int delegate(ref T) dg)

foreach support

opBinaryRight
bool opBinaryRight(T key)

key in set syntax support.

remove
size_t remove(E value)

Remove value from the map.

remove
size_t remove(E values)

Remove values from the map.

Manifest constants

CompCondition
enum CompCondition;
Undocumented in source.
HashKeyArg
enum HashKeyArg;
Undocumented in source.

Mixins

__anonymous
mixin Table!(Set, T, SlotType, Allocator, hasIndirections!T)
Undocumented in source.

Properties

keys
T[] keys [@property getter]

Mixed In Members

From mixin Table!(Set, T, SlotType, Allocator, hasIndirections!T)

HeapAlignment
enum HeapAlignment;
Undocumented in source.
this
this()
Undocumented in source.
this
this(Allocator allocator)

Constructor with the Allocator.

this
this(Allocator allocator, size_t capacity)

Constructor taking an initial capacity and the Allocator. Given capacity is automatically normalized to proper value.

this
this(size_t capacity)

Constructor taking an initial capacity. Given capacity is automatically normalized to proper value.

~this
~this()
Undocumented in source.
length
size_t length [@property getter]
capacity
size_t capacity [@property getter]
hashSeed
size_t hashSeed [@property setter]

Setter for hash seed.

dup
Container dup()
rehash
void rehash(size_t cap)

Reorganizes the container in place.

clear
void clear(bool reuse)

Removes all remaining slots from a container.

Parameters

T

element type

Allocator

Allocator type for internal allocation. Default is "shared const Mallocator"

NOTE: Set doesn't guarantee pointer stability. Range and returned pointers are invalidated after insert/rehash.

Examples

// Initialize Set with capacity
auto set = Set!(string)(10);  // Default capacity is 0
set.insert("key");  // set.insert(["k1", "k2"]) also supported
if ("key" in set)
  // do something
set.remove("key");  // set.remove(["k1", "k2"]) also supported

set.length;
set.clear;
set.rehash;
set.dup;
K[] keys = set.keys;
foreach (k; set.byKey()) {}

Meta