shared - i need it to be useful

12345swordy alexanderheistermann at gmail.com
Sun Oct 21 19:10:01 UTC 2018


On Sunday, 21 October 2018 at 18:45:15 UTC, Walter Bright wrote:
> I'd like to add that if the compiler can prove that a T* points 
> to a unique T, then it can be implicitly cast to shared(T)*. 
> And it does so, like the result of .dup can be so converted.

This can be achieved by using the unique struct and enforce the 
uniqueness at compile time.

https://github.com/dlang/phobos/blob/master/std/typecons.d#L130


More information about the Digitalmars-d mailing list