Anonymous nogc class
Jiyan via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 8 12:07:58 PDT 2017
On Friday, 8 September 2017 at 16:10:55 UTC, Biotronic wrote:
> On Friday, 8 September 2017 at 12:32:35 UTC, Jiyan wrote:
>> [...]
>
> It's scoped!T's destructor. If you decide to use that
> workaround, you should probably copy scoped!T from std.typecons
> and have your own version. It's not safe in all cases, and the
> next standard library update might break it.
>
>> [...]
>
> In your case, scoped!T is can be safely called from @nogc code,
> and thus could be marked @nogc. However, when a class C has a
> destructor that allocates, scoped!C could not be @nogc. So in
> order to be safe in all cases, it can't be @nogc in the general
> case.
>
> --
> Biotronic
Thank you very much :)
More information about the Digitalmars-d-learn
mailing list