On Sunday, 22 September 2013 at 23:49:56 UTC, Andrei Alexandrescu
wrote:
struct NullAllocator
{
enum alignment = real.alignof;
enum size_t available = 0;
ubyte[] allocate(size_t s) shared { return null; }
bool expand(ref ubyte[] b, size_t minDelta, size_t
maxDelta) shared
{ assert(b is null); return false; }
bool reallocate(ref ubyte[] b, size_t) shared
{ assert(b is null); return false; }
void deallocate(ubyte[] b) shared { assert(b is null); }
void collect() shared { }
void deallocateAll() shared { }
static shared NullAllocator it;
}
Does the presence of "shared" indicate that all allocators must
be thread-safe?
Will we be able to define thread-unsafe allocators, designed for
use on one thread for performance reasons?