The OpenD Programming Language

Segregator.allocatorForSize

Composite allocators involving nested instantiations of Segregator make it difficult to access individual sub-allocators stored within. allocatorForSize simplifies the task by supplying the allocator nested inside a Segregator that is responsible for a specific size s.

struct Segregator(size_t threshold, SmallAllocator, LargeAllocator)
ref
allocatorForSize
(
size_t s
)
()

Examples

alias A = Segregator!(300,
    Segregator!(200, A1, A2),
    A3);
A a;
static assert(typeof(a.allocatorForSize!10) == A1);
static assert(typeof(a.allocatorForSize!250) == A2);
static assert(typeof(a.allocatorForSize!301) == A3);

Meta