shared_ptr - basics and internals with examples--Hitesh Kumar

Did you know it?

shared_ptr - basics and internals with examples

by Hitesh Kumar

From the article:

The C++11 std::shared_ptr<T> is a shared ownership smart pointer type. Several shared_ptr instances can share the management of an object's lifetime through a common control block. The managed object is deleted when the last owning shared_ptr is destroyed (or is made to point to another object). Memory management by shared_ptr is deterministic because the timing of a managed object's destruction is predictable and in the developer's control. Hence, std::shared_ptr brings deterministic automatic memory management to C++, without the overhead of garbage collection. Here is a basic example of shared_ptr...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.