automem v0.0.7 - C++ style smart pointers using std.experimental.allocator
Nicholas Wilson via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Apr 11 03:24:08 PDT 2017
On Tuesday, 11 April 2017 at 09:53:46 UTC, Martin Nowak wrote:
> I think we might be able to solve this problem in D by making
> IAllocator.allocate pure, which tells the compiler that this
> function returns a fresh piece of memory without any
> side-effect, i.e. enough information to optimize away
> allocations.
>
> Pure might be too restrictive for some allocators, but maybe
> this can be solved with a little type system hack (or at worse
> a compiler exemption).
In LDC we have an attribute for that `allocSize`
(https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/attributes.d#L16)
perhaps this attribute should be used across compilers and be in
druntime?
More information about the Digitalmars-d-announce
mailing list