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.

猜你喜欢

转载自my.oschina.net/itfanr/blog/1802769