SmartRef: The Smart Pointer In D

Dsby via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Jan 15 07:42:19 PST 2017


On Saturday, 14 January 2017 at 17:35:09 UTC, Nordlöw 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.
>
> How do two of these differ from
>
> - https://dlang.org/phobos/std_typecons.html#.RefCounted
> - https://dlang.org/phobos/std_typecons.html#.Unique
>
> under
>
> https://dlang.org/phobos/std_typecons.html
>
> ?
The RefCount not support class or inteface, and the ref count is 
not atomic , it not thread safe.
The Unique is base of GC. It can not @nogc. And it use the 
'delete' keyword , it will be 
deprcated(http://dlang.org/deprecate.html).

The SmartRef is Base std.experimental.allocator. You can control 
where the memony allocator.
And the smartref.sharedref use the atomic default, you alse can 
not use atomic。 And have the smartref.weakref with sharedref to 
fix circular reference.


More information about the Digitalmars-d-announce mailing list