On Monday, 27 November 2017 at 07:03:01 UTC, Ola Fosheim Grostad wrote:
On Monday, 27 November 2017 at 06:47:00 UTC, Dmitry Olshansky wrote:
Last time I check shared_ptr can be safely shared across threads, hence RC is takling synchronization and most likely atomics since locks won’t be any better.

The controlblock can, but it is crazy to use shared_ptr for anything more than high level ownership. It is a general solution with weak pointers and extra indirection, not a typical RC implementation for datastructures.

Then watch Herb’s Sutter recent talk “Leak freedom by default”. Now THAT guy must be out of his mind :)

I have no idea what are your typical C++ programmers.


In C++ sync is manual, which is the only efficient way to do

??? shared_ptr is nowhere manual.

There is an upcoming atomic_shared_ptr, but it is not in the standard yet.

atomic_shared_pointer is nothing but what you seem to imply. It’s not manual sync for one.


My post is about particular primitive in C++ std, what could be done instead or in addition to is not important.

Oh, but it is.

You keep spreading FUD on this forum, I’m still not sure of your reasons though.


1. D currently does not provide what you says it does.

RefCounted!T


2. Sane C++ programmers rarely use shared_ptr for more than exchsnging ownership (suitable for sharing things like bitmap textures).

Including across threads btw.

There are plenty of other RC implementations for tracking memory.

Like what? In standard C++ all you’ve got is unique_ptr and shared_ptr (and weak but that besides the point). There is maybe a ton of reimplementations of said things.


Reply via email to