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
Name | Description |
---|---|
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
Name | Type | Description |
---|---|---|
alloc
|
RegionAllocator | |
freeList
|
StackTreeAA | |
rKeys
|
Unqual!K[] | |
rNext
|
StackTreeAA | |
_length
|
size_t |
Properties
Name | Type | Description |
---|---|---|
length [get]
|
size_t |
Methods
Name | Description |
---|---|
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
Name | Description |
---|---|
Node1
|
|
Node2
|
Examples
auto alloc = newRegionAllocator();
auto ss = StackSet!(uint)(5, alloc);
foreach(i; 0..5) {
ss .insert(i);
}
assert(3 in ss);