On Wednesday, 16 July 2014 at 17:18:56 UTC, Kagamin wrote:
On Wednesday, 16 July 2014 at 11:22:45 UTC, Remo wrote:
And then he pointed to a "A Unified Theory of Garbage Collection" paper where "reference counting" as a strategy (method) for a Garbage Collection will be disused.
This is NOT the same as std::shared_ptr do !

How std::shared_ptr manages cycles?

There is std::weak_ptr to handle cycles.
http://en.cppreference.com/w/cpp/memory/weak_ptr
The only question is how often one need to handle cycles ?


Using GC is probably easier as shared_ptr in some case.
But in many other cases only lightweight and deterministic unique_ptr is required.

Apparently in Rust one can decide what to use.
Box<T> the same as std::unique_ptr<T> in C++.
Rc<T> is something like std::shared_ptr<T> in C++ but not exactly the same. But there are also Gc<T> (Immutable garbage-collected pointer) and Arc<T> without counterparts in C++ at this time.

Reply via email to