isAllocator

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 30 19:05:29 PST 2015


On 01/12/15 3:23 AM, Tofu Ninja wrote:
> On Monday, 30 November 2015 at 14:21:49 UTC, Tofu Ninja wrote:
>> Is there something like isInputRange for allocators, I tried looking
>> for something but couldn't find anything? If not, why not?
>
> Aka, some way to check that type T is an allocator.

Doesn't look like it.

bool isAllocator(Alloc)() pure {
	return __traits(compiles, {IAllocator alloc = new CAllocatorImpl!Alloc;});
}

That should work however.


More information about the Digitalmars-d-learn mailing list