automem v0.0.7 - C++ style smart pointers using std.experimental.allocator

Martin Nowak via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Apr 11 01:09:15 PDT 2017


On Sunday, 9 April 2017 at 10:22:49 UTC, Atila Neves wrote:
> I did not. Thanks for telling me!
>
> The way I wrote it RefCounted!(shared T) works - RefCounted 
> doesn't have to be shared itself, but I guess it could be.

I think the other design is slightly more correct, having a 
single thread own a shared value => RefCounted!(shared T), having 
multiple threads own a value (which is transitively shared) => 
shared(RefCounted!T).

The latter is also neede for `static shared RC!T rc;`.




More information about the Digitalmars-d-announce mailing list