On 12-Jul-2015 18:08, Jacob Carlborg wrote:
On 2015-06-12 13:06, Dicebot wrote:
The legendary allocator package by Andrei Alexandrescu has arrived at
your doorsteps and kindly asks to let it into Phobos

http://wiki.dlang.org/Review/std.experimental.allocator

Docs:
http://erdani.com/d/phobos-prerelease/std_experimental_allocator.html
Code:
https://github.com/andralex/phobos/tree/allocator/std/experimental/allocator


I just looked at Andrei's dconf talk and started to look at the source
code how this "hasMember" is used. To me it looks like in most cases the
optional methods, like "deallocate", "owns", "expand" and so on, could
instead be required methods. Allocators that don't support these methods
would need to have dummy implementations. But at the same time it would
be easier for the user of the allocators, doesn't need to use all these
"static if".

But then a Parent allocator would like to know if the child actually doesn't support reallocate vs say failing to reallocate. In the former case a lot of extra logic is simply removed at compile-time.


--
Dmitry Olshansky

Reply via email to