On Saturday, 13 July 2013 at 12:47:28 UTC, bearophile wrote:
...

Hm, actually naive scoped usage seems to work for me:

---------------------------------------
import std.typecons;

class B
{
        byte a;
}

class A
{
        typeof(scoped!B()) b = void;
        
        this()
        {
                b = scoped!B();
        }
}
---------------------------------------

...with only exception (bug?) - I can't default-construct A on heap after that. It works as expected if I created A via scoped or use non-default constructor.

Reply via email to