Proposal to make "shared" (more) useful

Kagamin spam at here.lot
Thu Sep 13 15:16:42 UTC 2018


struct Unshared(T)
{
     private T value;
     T get() shared { return cast(T)value; }
     alias get this;
     void opAssign(T v) shared { value=cast(shared)v; }
}

shared synchronized class A
{
     private Unshared!(int[]) a;
     int[] f()
     {
         return a;
     }
}



More information about the Digitalmars-d mailing list