Struct StackSet

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

struct StackSet(K) ;

Constructors

NameDescription
this 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.

Fields

NameTypeDescription
alloc RegionAllocator
freeList StackTreeAA.Node**
rKeys Unqual!K[]
rNext StackTreeAA.Node*[]
_length size_t

Properties

NameTypeDescription
length[get] size_t

Methods

NameDescription
allocNode
elems Returns a forward range of the elements of this struct. The range's lifetime must not exceed the lifetime of this object.
getHash
insert
newNode
opIn_r
pushFreeList
remove
usedSentinel

Inner structs

NameDescription
Node1
Node2

Examples

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