View source code
Display the source code in std/experimental/allocator/common.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.

Enum member std.experimental.allocator.common.isAllocator

Is true iff A is an allocator.

enum isAllocator(A) = is(typeof(A.allocate(size_t.init)) == void[]) && is(typeof(A.alignment) : size_t);


import std.experimental.allocator.building_blocks.null_allocator : NullAllocator;
import std.experimental.allocator.mallocator : Mallocator;
import std.experimental.allocator.gc_allocator : GCAllocator;
import std.experimental.allocator.mmap_allocator : MmapAllocator;
static assert(isAllocator!NullAllocator);
static assert(isAllocator!Mallocator);
static assert(isAllocator!GCAllocator);
static assert(isAllocator!MmapAllocator);
static assert(!isAllocator!int);


Andrei Alexandrescu, Timon Gehr (Ternary)