| Technical Specification | ||||
| Filesystem library(filesystem TS) | ||||
| Library fundamentals(library fundamentals TS) | ||||
| Library fundamentals 2(library fundamentals TS v2) | ||||
| Library fundamentals 3(library fundamentals TS v3) | ||||
| Extensions for parallelism(parallelism TS) | ||||
| Extensions for parallelism 2(parallelism TS v2) | ||||
| Extensions for concurrency(concurrency TS) | ||||
| Extensions for concurrency 2(concurrency TS v2) | ||||
| Concepts(concepts TS) | ||||
| Ranges(ranges TS) | ||||
| Reflection(reflection TS) | ||||
| Mathematical special functions(special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
experimental::shared_ptr | ||||
| Type-erased and polymorphic allocators | ||||
| Variable templates for type traits |
| Member functions | ||||
| Non-member functions | ||||
Members and non-members identical to those ofstd::shared_ptr |
Defined in header <experimental/memory> | ||
template<class T>class shared_ptr; | (library fundamentals TS) | |
std::experimental::shared_ptr is a modified version ofstd::shared_ptr that adds support for arrays.
Contents |
| Member type | Definition |
| element_type | std::remove_extent_t<T> |
constructs newshared_ptr(public member function)[edit] | |
Observers | |
| returns the stored pointer (public member function)[edit] | |
| dereferences the stored pointer (public member function)[edit] | |
| provides index access to the array (public member function)[edit] | |
| appliesstatic_cast,dynamic_cast,const_cast, orreinterpret_cast to the stored pointer (function template)[edit] |
| hash support forstd::experimental::shared_ptr (class template specialization)[edit] |
The following member functions work withstd::experimental::shared_ptr instead ofstd::shared_ptr andstd::experimental::weak_ptr instead ofstd::weak_ptr. The behavior is otherwise identical.
destructs the owned object if no moreshared_ptrs link to it(public member function of std::shared_ptr<T>)[edit] | |
assigns theshared_ptr(public member function of std::shared_ptr<T>)[edit] | |
Modifiers | |
| replaces the managed object (public member function of std::shared_ptr<T>)[edit] | |
| swaps the managed objects (public member function of std::shared_ptr<T>)[edit] | |
Observers | |
returns the number ofshared_ptr objects referring to the same managed object(public member function of std::shared_ptr<T>)[edit] | |
(until C++20) | checks whether the managed object is managed only by the currentshared_ptr object(public member function of std::shared_ptr<T>)[edit] |
| checks if the stored pointer is not null (public member function of std::shared_ptr<T>)[edit] | |
| provides owner-based ordering of shared pointers (public member function of std::shared_ptr<T>)[edit] | |
These non-member functions are declared in thestd::experimental namespace, and work withstd::experimental::shared_ptr rather thanstd::shared_ptr, but otherwise behaves identically to the corresponding C++14 function.
| creates a shared pointer that manages a new object (function template)[edit] | |
| creates a shared pointer that manages a new object allocated using an allocator (function template)[edit] | |
| returns the deleter of specified type, if owned (function template)[edit] | |
(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(C++20) | compares with anothershared_ptr or withnullptr(function template)[edit] |
| outputs the value of the stored pointer to an output stream (function template)[edit] | |
(C++11) | specializes thestd::swap algorithm (function template)[edit] |
specializes atomic operations forstd::shared_ptr(function template)[edit] |
These class templates are declared in thestd::experimental namespace, and work withstd::experimental::shared_ptr andstd::experimental::weak_ptr rather thanstd::shared_ptr andstd::weak_ptr, but otherwise behaves identically to the corresponding C++14 class template.
(C++11) | provides mixed-type owner-based ordering of shared and weak pointers (class template)[edit] |
(C++11) | allows an object to create ashared_ptr referring to itself(class template)[edit] |
| This section is incomplete Reason: no example |