UDA and trait for non-GC managed pointers
Nordlöw via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 15 10:19:53 PDT 2016
On Saturday, 15 October 2016 at 17:11:28 UTC, Andrei Alexandrescu
wrote:
> Seems there'd be quite some annotational overhead.
In the case of a C++-style vector it's just a matter of changing
E* _ptr; // non-GC-allocated store pointer
to
@nogc E* _ptr; // GC-allocated store pointer
and then updating the relevant trait, such as `hasIndirections`
or/and `hasAliasing`, to respect this attribute.
That doesn't seem to hard, right? Or am I missing something?
BTW: Should I use
https://dlang.org/phobos/std_traits.html#hasIndirections
or
https://dlang.org/phobos/std_traits.html#hasAliasing
ẁhen checking if I need to call `GC.addRange` and
`GC.removeRange`?
The difference is whether we should include immutable
indirections or not.
More information about the Digitalmars-d
mailing list