Re: SmartRef: The Smart Pointer In D

Dmitry Olshansky via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Jan 14 07:41:01 PST 2017


On 1/14/17 3:20 AM, Swoorup Joshi wrote:
> On Saturday, 14 January 2017 at 02:05:11 UTC, nbro wrote:
>> On Friday, 13 January 2017 at 16:50:37 UTC, Dsby wrote:
>>> I write the ref count pointer and the scoped point in D.
>>> it just Like cpp's shared_ptr , waek_ptr and unique_ptr .
>>> Now, it is  Developing.
>>> I will write more test before the frist release.
>>> And the docs is null.
>>> It on github: https://github.com/huntlabs/SmartRef
>>
>> What's would be the advantages of smart pointers in D?
>
> Simple, Same Advantages you would get with C++ smart pointers.

Not quite true, there is at least one huge advantage - thread-locality.
That is C++ smart_ptr has to be atomic, while its D counter part may 
safely be non-atomic because everything is TLS be default.

Of course, there is a place for smart pointer shared across threads, but 
I'd personally go with message passing instead.

---
Dmitry Olshansky


More information about the Digitalmars-d-announce mailing list