On 05/01/2017 08:12 AM, Guillaume Piolat wrote:
On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote:
A pass through the root allocators (Mallocator, GCAllocator etc)
figuring out what attributes could be meaningfully attached would be
welcome. The rest would rely on inference.
Thanks,
Andrei
IAllocator being fully @nogc would be a comforting guarantee, as runtime
dispatch makes for lighter types.
As I said (and am encouraging you to do this), this is achieved through
simple variance:
interface INoGCAllocator : IAllocator {
... override all methods here as @nogc ...
}
This is possible because a @nogc method may override one that is not
@nogc. @nogc being more restrictive it is contravariant with no-@nogc.
Also IAllocator should have a few @nogc methods to start with; there's
no reason e.g. for empty() to create garbage.
Could you please initiate a PR?
Andrei