`shared`...

deadalnix deadalnix at gmail.com
Mon Oct 1 18:44:17 UTC 2018


On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote:
> I feel like I don't understand the design...
> mutable -> shared should work the same as mutable -> const... 
> because
> surely that's safe?
>

Nope. Consider.

struct A {
    A* a;
}

void foo(shared A* a) {
     a.a = new shared(A))();
}

Now you have effectively made a.a accessible as a mutable when it 
is shared.


More information about the Digitalmars-d mailing list