Several smart pointers in c++

scoped_ptr, used to contain ownership of a dynamically allocated object to the current scope;

scoped_array, which provides scoped ownership for a dynamically allocated array;

shared_ptr, a versatile tool for managing shared ownership of an object or array;

weak_ptr, a non-owning observer to a shared_ptr-managed object that can be promoted temporarily to shared_ptr;

intrusive_ptr, a pointer to objects with an embedded reference count;

local_shared_ptr, providing shared ownership within a single thread.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325074043&siteId=291194637