std::experimental::shared_ptr
 
 
| template< class T > class shared_ptr; |  | (library fundamentals TS) | 
|  |  |  | 
std::experimental::shared_ptr is a modified version of std::shared_ptr that adds support for arrays.
[edit] Member types
[edit] Member functions
|
|  | constructs new shared_ptr(public member function)
 | 
|    Observers 
 | 
|
|  | returns the stored pointer (public member function)
 | 
|
|
|  | dereferences the stored pointer (public member function)
 | 
|
|  | provides index access to the array (public member function)
 | 
[edit] Non-member functions
[edit] Helper classes
|
|  | hash support for std::experimental::shared_ptr (class template specialization)
 | 
 Members and non-members identical to std::shared_ptr 
 Member functions
The following member functions work with std::experimental::shared_ptr instead of std::shared_ptr and std::experimental::weak_ptr instead of std::weak_ptr. The behavior is otherwise identical.
|
|  | destructs the owned object if no more shared_ptrs link to it(public member function of
 std::shared_ptr) | 
|
|  | assigns the shared_ptr(public member function of
 std::shared_ptr) | 
|    Modifiers 
 | 
|
|  | replaces the managed object (public member function of
 std::shared_ptr) | 
|
|  | swaps the managed objects (public member function of
 std::shared_ptr) | 
|    Observers 
 | 
|
|  | returns the number of shared_ptrobjects referring to the same managed object(public member function of
 std::shared_ptr) | 
|
|  | checks whether the managed object is managed only by the current shared_ptrinstance(public member function of
 std::shared_ptr) | 
|
|  | checks if there is associated managed object (public member function of
 std::shared_ptr) | 
|
|  | provides owner-based ordering of shared pointers (public member function of
 std::shared_ptr) | 
 Non-member functions
These non-member functions are declared in the std::experimental namespace, and work with std::experimental::shared_ptr rather than std::shared_ptr, but otherwise behaves identically to the corresponding C++14 function.
|
|  | creates a shared pointer that manages a new object (function template)
 | 
|
|  | creates a shared pointer that manages a new object allocated using an allocator (function template)
 | 
|
|  | returns the deleter of specified type, if owned (function template)
 | 
|
|
|
|
|
|
|  | compares with another shared_ptror with nullptr(function template)
 | 
|
|  | outputs the value of the stored pointer to an output stream (function template)
 | 
|
|  | specializes the std::swap algorithm (function template)
 | 
 Helper class templates 
These class templates are declared in the std::experimental namespace, and work with std::experimental::shared_ptr and std::experimental::weak_ptr rather than std::shared_ptr and std::weak_ptr, but otherwise behaves identically to the corresponding C++14 class template.
|
|  | provides mixed-type owner-based ordering of shared and weak pointers (class template)
 | 
|
|  | allows an object to create a shared_ptrreferring to itself(class template)
 | 
 
[edit] Example