std.experimental.allocator and @nogc

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sun May 8 23:35:36 PDT 2016


On 09/05/2016 6:22 PM, Hildigard Sandyman wrote:
> It's true but... why do you bother with IAllocator ? Everything can be
> set a compile time with a template parameter. As long as the param is a
> struct with allocate/deallocate/reallocate it's OK. you can use already
> a good part of the package content in a @nogc fashion.
>
> Do you have an example where IAllocator must be used and where, for
> example, Mallocator can't be passed ?!

The moment where you need to use OOP, you most definitely need IAllocator.
I cannot make a windowing library without the use of IAllocator.

You can't always template functions with the type that is the allocator.
Its just not possible or reasonable.


More information about the Digitalmars-d mailing list