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".
The current way of using "hasMember" and "static if" seems to be a more
complicated design.
--
/Jacob Carlborg