On 09/11/2015 06:32 PM, bitwise wrote:
On Friday, 25 October 2013 at 00:00:36 UTC, Andrei Alexandrescu wrote:
On 10/24/13 2:38 PM, Namespace wrote:
On Thursday, 24 October 2013 at 21:31:42 UTC, Namespace wrote:
Awesome! Will Appender get an option to use a suitable allocator?
A dream of me, that will probably never come true, would be also
something like this:
----
with (Mallocator) {
int[] arr;
arr ~= 42; /// will use Mallocator.it.allocate internal
}
----
Oddly enough this can be actually done.
with (setAllocator!Mallocator)
{
...
}
setAllcator returns an rvalue that changes the global allocator to the
Mallocator in the constructor, and restores it to whatever it was in
the destructor.
Andrei
Doesn't this race because the allocator instance is shared?
I couldn't find 'setAllocator' in the source code.
Yah, that was a rumination, not something already implemented. -- Andrei