Old Quora post: D vs Go vs Rust by Andrei Alexandrescu
Petar
Petar
Fri Jan 5 22:09:03 UTC 2018
On Friday, 5 January 2018 at 20:20:04 UTC, jmh530 wrote:
> On Friday, 5 January 2018 at 03:11:42 UTC, jmh530 wrote:
>> [...]
>
> In std.experimental.allocator, I was thinking that in something
> like GCAllocator you could have the allocate function be a
> template that changes the behavior based on the the type you
> are trying to create. So for instance, if you are creating a
> const/immutable object do one thing and if creating a mutable
> object do something else. However, it looks like the allocate
> function is not templatized so it might require a bit of
> modification to get it work. It also mean the allocator would
> depend on the type it is trying to create, which may not be a
> design they want to pursue.
>
> [...]
It seems you are thinking about this:
https://dlang.org/phobos-prerelease/std_experimental_allocator_typed.html
More information about the Digitalmars-d
mailing list