Safe reference counting cannot be implemented as a library

rsw0x via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 27 13:45:33 PDT 2015


On Tuesday, 27 October 2015 at 20:41:49 UTC, Jonathan M Davis 
wrote:
> On Tuesday, 27 October 2015 at 20:19:42 UTC, PuglyWUgly wrote:
>>  Why care about this?
>>
>>  Even Rust doesn't try to solve this problem...because it 
>> isn't really a problem in practice.
>>
>>  In c++/rust code you use value/unique types 99.9% of the 
>> time, and reference counting is only for shared/aliased 
>> objects.
>>
>>
>>  Reference counting == rare and unimportant
>
> Really? I've seen tons of C++ code that's written using smart 
> pointers with objects living on the heap which then get passed 
> around all over the place.

if they're using shared_ptr all over the place, they're doing it 
wrong.
shared_ptr is supposed to be a last resort



More information about the Digitalmars-d mailing list