Sneak preview into std.allocator's porcelain

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Wed May 6 23:00:00 PDT 2015


On Thursday, 7 May 2015 at 02:28:45 UTC, Andrei Alexandrescu 
wrote:
> http://erdani.com/d/phobos-prerelease/std_experimental_allocator_porcelain.html
>
> Andrei

Now that https://issues.dlang.org/show_bug.cgi?id=8269 was fixed, 
how about that idea of using with(scopeAllocator(...)) { /* use 
theAllocator */ } ?

I.e. encapsulating

auto oldAllocator = theAllocator;
scope(exit) theAllocator = oldAllocator;
theAllocator = allocatorObject(...);

into a nice RAII type and then using it with WithStatement.


More information about the Digitalmars-d mailing list