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

Atila Neves via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Apr 11 04:51:13 PDT 2017


On Tuesday, 11 April 2017 at 08:09:15 UTC, Martin Nowak wrote:
> 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;`.

Unfortunately I later remembered that because it has a destructor 
it can't be shared and not shared with the sample implementation. 
And I'd really like to avoid having to have two different names 
like Rust does with Rc and Arc.

Atila


More information about the Digitalmars-d-announce mailing list