Sneak preview into std.allocator's porcelain

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu May 7 11:25:59 PDT 2015


On 5/7/15 11:06 AM, Vladimir Panteleev wrote:
> On Thursday, 7 May 2015 at 17:57:24 UTC, Andrei Alexandrescu wrote:
>> On 5/6/15 11:00 PM, Vladimir Panteleev wrote:
>>> 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.
>>
>> Sadly that won't be possible with the current design; all higher-level
>> functions are not methods and instead rely on UFCS. -- Andrei
>
> Not what I meant. This is your idea:
>
> http://forum.dlang.org/post/l4ccb4$25ul$1@digitalmars.com

Oh I see. That will be operational once we get the built-in allocating 
expressions (new, array literals, delegates...) to use theAllocator. 
Cool, thanks, -- Andrei


More information about the Digitalmars-d mailing list