On Tuesday, 3 July 2018 at 02:13:21 UTC, Flaze07 wrote:
e.g A is a class that emits output during destruction
{
    auto a = scoped!A();
}

how do I contain it in a container, in the Array struct ?

{
    auto a = scoped!A();
    Array!( typeof( a ) ) arr;
    foreach( i ; 0..3 ) {
        arr.insertBack( scoped!A );
    }
}

is that how you do it ?


Copying/moving scoped!Class is very unsafe. scoped!Class is struct and have all of limitations of structs like no internal pointers to itself...
That's why it is not copyable.

Reply via email to