The OpenD Programming Language

StackSet

A hash set that allocates its memory on RegionAllocator. Good for building a temporary set that will not escape the current scope.

Constructors

this
this(size_t nElem, RegionAllocator alloc)

Due to the nature of RegionAllocator, you must specify on object creation * the approximate number of elements your set will have. Too large a * number will waste space and incur poor cache performance. Too low a * number will make this struct perform like a linked list. Generally, * if you're building a set from some other range, some fraction of the * size of that range is a good guess.

Members

Functions

elems
auto elems()

Returns a forward range of the elements of this struct. The range's * lifetime must not exceed the lifetime of this object.

insert
void insert(K key)
opBinaryRight
bool opBinaryRight(K key)
remove
void remove(K key)

Properties

length
size_t length [@property getter]

Examples

auto alloc = newRegionAllocator();
auto ss = StackSet!(uint)(5, alloc);
foreach(i; 0..5) {
    ss.insert(i);
}
assert(3 in ss);

Meta