std::experimental::shared_ptr (3) - Linux Man Pages

std::experimental::shared_ptr: std::experimental::shared_ptr

NAME

std::experimental::shared_ptr - std::experimental::shared_ptr

Synopsis


Defined in header <experimental/memory>
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.

Member types


Member type Definition
element_type std::remove_extent_t<T>

Member functions


              constructs new shared_ptr
constructor (public member function)

Observers


              returns the stored pointer
get (public member function)
              dereferences the stored pointer
operator* (public member function)
operator->
              provides index access to the array
operator[] (public member function)

Non-member functions


static_pointer_cast applies static_cast, dynamic_cast, const_cast, or reinterpret_cast to the stored pointer
dynamic_pointer_cast (function template)
const_pointer_cast
reinterpret_pointer_cast

Helper classes


                                         hash support for std::experimental::shared_ptr
std::hash<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
destructor (public member function of std::shared_ptr<T>)
              assigns the shared_ptr
operator= (public member function of std::shared_ptr<T>)

Modifiers


              replaces the managed object
reset (public member function of std::shared_ptr<T>)
              swaps the managed objects
swap (public member function of std::shared_ptr<T>)

Observers


              returns the number of shared_ptr objects referring to the same managed object
use_count (public member function of std::shared_ptr<T>)


unique checks whether the managed object is managed only by the current shared_ptr instance
              (public member function of std::shared_ptr<T>)
(until C++20)
              checks if the stored pointer is not null
operator_bool (public member function of std::shared_ptr<T>)
              provides owner-based ordering of shared pointers
owner_before (public member function of std::shared_ptr<T>)

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.


make_shared
make_shared_default_init creates a shared pointer that manages a new object
                             (function template)


(C++20)


allocate_shared
allocate_shared_default_init creates a shared pointer that manages a new object allocated using an allocator
                             (function template)


(C++20)
                             returns the deleter of specified type, if owned
get_deleter (function template)


operator==
operator!= compares with another shared_ptr or with nullptr
operator< (function template)
operator<=
operator>
operator>=
                             outputs the value of the stored pointer to an output stream
operator<< (function template)


std::swap(std::shared_ptr) specializes the std::swap algorithm
                             (function template)
(C++11)


std::atomic_is_lock_free(std::shared_ptr)
std::atomic_load(std::shared_ptr)
std::atomic_load_explicit(std::shared_ptr)
std::atomic_store(std::shared_ptr)
std::atomic_store_explicit(std::shared_ptr)
std::atomic_exchange(std::shared_ptr) specializes atomic operations for std::shared_ptr
std::atomic_exchange_explicit(std::shared_ptr) (function template)
std::atomic_compare_exchange_weak(std::shared_ptr)
std::atomic_compare_exchange_strong(std::shared_ptr)
std::atomic_compare_exchange_weak_explicit(std::shared_ptr)
std::atomic_compare_exchange_strong_explicit(std::shared_ptr)


(deprecated in C++20)


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.


owner_less provides mixed-type owner-based ordering of shared and weak pointers
                        (class template)
(C++11)


enable_shared_from_this allows an object to create a shared_ptr referring to itself
                        (class template)
(C++11)

Example


 This section is incomplete
 Reason: no example