std.experimental.allocator.building_blocks.segregator
Types 1
Dispatches allocations (and deallocations) between two allocators (SmallAllocator and LargeAllocator) depending on the size allocated, as follows. All allocations smaller than or equal to threshold will be dispatched to SmallAllocator. The others will go to LargeAllocator.
If both allocators are shared, the Segregator will also offer shared methods.
uint alignmentprivate !stateSize!SmallAllocator
&& !stateSize!LargeAllocator
&& is(typeof(SmallAllocator.instance) == shared)
&& is(typeof(LargeAllocator.instance) == shared) sharedMethodsref auto allocatorForSize(size_t s)()Composite allocators involving nested instantiations of `Segregator` make it difficult to access individual sub-allocators stored within. allocatorForSize simplifies the task by supplying the alloc...Impl()Templates 1
if (Args.length > 3)A Segregator with more than three arguments expands to a composition of elemental Segregators, as illustrated by the following example:
---- alias A = Segregator!( n1, A1, n2, A2, n3, A3, A4 ); ----
With this definition, allocation requests for n1 bytes or less are directed to A1; requests between n1 + 1 and n2 bytes (inclusive) are directed to A2; requests between n2 + 1 and n3 bytes (inclusive) are directed to A3; and requests for more than n3 bytes are directed to A4. If some particular range should not be handled, NullAllocator may be used appropriately.