What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 10 06:15:09 PDT 2015


On Thursday, 10 September 2015 at 12:34:54 UTC, Daniel Kozák 
wrote:
>
> On Thu, 10 Sep 2015 11:38:35 +0000
> "Gary Willoughby" <dev at nomad.so> wrote:
>
>> On Wednesday, 9 September 2015 at 23:22:49 UTC, ponce wrote:
>> > - RefCounted
>> >
>> > Only for D structs. std::shared_ptr works for all.
>> 
>> RefCounted works with classes as well.
>> 
>> http://dlang.org/phobos/std_typecons.html#.RefCounted
>
> struct RefCounted(T, RefCountedAutoInitialize autoInit =
> RefCountedAutoInitialize.yes) if (!is(T == class) && !is(T ==
> interface));
>
> if (!is(T == class) && !is(T ==interface)); // So it does not 
> work
> with classes

Sorry my mistake.


More information about the Digitalmars-d-learn mailing list