View source code
Display the source code in std/experimental/allocator/building_blocks/segregator.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.experimental.allocator.building_blocks.segregator.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.

ref auto allocatorForSize(size_t s)();

Example

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);

Authors

License