throwing_ptr
Smart pointers that throw on dereference if null
|
Implementations of throwing::shared_ptr, throwing::unique_ptr and related. More...
Namespaces | |
detail | |
Helpers for make_unique type resolution, see n3656. | |
Classes | |
class | base_null_ptr_exception |
Base class thrown upon dereferencing a null shared_ptr. More... | |
class | null_ptr_exception |
Concrete class thrown upon dereferencing a null shared_ptr. More... | |
class | shared_ptr |
Wrapper aroung std::shared_ptr that throws when a wrapped null pointer is dereferenced. More... | |
class | unique_ptr |
unique_ptr that manages a single object More... | |
class | unique_ptr< T[], Deleter > |
unique_ptr that manages a dynamically-allocated array of objects More... | |
Functions | |
template<class T > | |
void | swap (throwing::shared_ptr< T > &lhs, throwing::shared_ptr< T > &rhs) TSP_NOEXCEPT |
Specializes the std::swap algorithm for throwing::shared_ptr. More... | |
template<class T , class... Args> | |
shared_ptr< T > | make_shared (Args &&... args) |
Constructs an object of type T and wraps it in a throwing::shared_ptr using args as the parameter list for the constructor of T. More... | |
template<class T , class Alloc , class... Args> | |
shared_ptr< T > | allocate_shared (const Alloc &alloc, Args &&... args) |
Constructs an object of type T and wraps it in a throwing::shared_ptr using args as the parameter list for the constructor of T. More... | |
template<class T , class U > | |
shared_ptr< T > | static_pointer_cast (const shared_ptr< U > &r) TSP_NOEXCEPT |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a static_cast expression. More... | |
template<class T , class U > | |
shared_ptr< T > | dynamic_pointer_cast (const shared_ptr< U > &r) TSP_NOEXCEPT |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a dynamic_cast expression. More... | |
template<class T , class U > | |
shared_ptr< T > | const_pointer_cast (const shared_ptr< U > &r) TSP_NOEXCEPT |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a const_cast expression. More... | |
template<class T , class U > | |
shared_ptr< T > | reinterpret_pointer_cast (const shared_ptr< U > &r) TSP_NOEXCEPT |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a reinterpret_cast expression. More... | |
template<class Deleter , class T > | |
Deleter * | get_deleter (const shared_ptr< T > &p) TSP_NOEXCEPT |
Access to the p's deleter. More... | |
template<class T , class U > | |
bool | operator== (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator!= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator< (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator> (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator<= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator>= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator== (const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator!= (const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator< (const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator> (const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator<= (const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator>= (const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator== (const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator!= (const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator< (const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator> (const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator<= (const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T , class U > | |
bool | operator>= (const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT |
Compare two shared_ptr objects. More... | |
template<class T > | |
bool | operator== (const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator== (std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator!= (const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator!= (std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator< (const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator< (std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator> (const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator> (std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator<= (const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator<= (std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator>= (const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T > | |
bool | operator>= (std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT |
Compare a shared_ptr with a null pointer. More... | |
template<class T , class U , class V > | |
std::basic_ostream< U, V > & | operator<< (std::basic_ostream< U, V > &os, const shared_ptr< T > &ptr) |
Inserts the value of the pointer stored in ptr into the output stream os. More... | |
template<class T > | |
bool | atomic_is_lock_free (shared_ptr< T > const *p) |
Determines whether atomic access to the shared pointer pointed-to by p is lock-free. More... | |
template<class T > | |
shared_ptr< T > | atomic_load (const shared_ptr< T > *p) |
Equivalent to atomic_load_explicit(p, std::memory_order_seq_cst) More... | |
template<class T > | |
shared_ptr< T > | atomic_load_explicit (const shared_ptr< T > *p, std::memory_order mo) |
Returns the shared pointer pointed-to by p. More... | |
template<class T > | |
void | atomic_store (shared_ptr< T > *p, shared_ptr< T > r) |
Equivalent to atomic_store_explicit(p, r, memory_order_seq_cst) More... | |
template<class T > | |
void | atomic_store_explicit (shared_ptr< T > *p, shared_ptr< T > r, std::memory_order mo) |
Stores the shared pointer r in the shared pointer pointed-to by p atomically, effectively executing p->swap(r). More... | |
template<class T > | |
shared_ptr< T > | atomic_exchange (shared_ptr< T > *p, shared_ptr< T > r) |
Equivalent to atomic_exchange(p, r, memory_order_seq_cst) More... | |
template<class T > | |
shared_ptr< T > | atomic_exchange_explicit (shared_ptr< T > *p, shared_ptr< T > r, std::memory_order mo) |
Stores the shared pointer r in the shared pointer pointed to by p and returns the value formerly pointed-to by p, atomically. More... | |
template<class T > | |
bool | atomic_compare_exchange_weak (shared_ptr< T > *p, shared_ptr< T > *expected, shared_ptr< T > desired) |
Equivalent to atomic_compare_exchange_weak_explicit(p, expected, desired, std::memory_order_seq_cst, std::memory_order_seq_cst) More... | |
template<class T > | |
bool | atomic_compare_exchange_strong (shared_ptr< T > *p, shared_ptr< T > *expected, shared_ptr< T > desired) |
Equivalent to atomic_compare_exchange_strong_explicit(p, expected, desired, std::memory_order_seq_cst, std::memory_order_seq_cst) More... | |
template<class T > | |
bool | atomic_compare_exchange_strong_explicit (shared_ptr< T > *p, shared_ptr< T > *expected, shared_ptr< T > desired, std::memory_order success, std::memory_order failure) |
Compares the shared pointers pointed-to by p and expected. If they are equivalent (store the same pointer value, and either share ownership of the same object or are both empty), assigns desired into *p using the memory ordering constraints specified by success and returns true. If they are not equivalent, assigns *p into *expected using the memory ordering constraints specified by failure and returns false. More... | |
template<class T > | |
bool | atomic_compare_exchange_weak_explicit (shared_ptr< T > *p, shared_ptr< T > *expected, shared_ptr< T > desired, std::memory_order success, std::memory_order failure) |
Compares the shared pointers pointed-to by p and expected. If they are equivalent (store the same pointer value, and either share ownership of the same object or are both empty), assigns desired into *p using the memory ordering constraints specified by success and returns true. If they are not equivalent, assigns *p into *expected using the memory ordering constraints specified by failure and returns false, but may fail spuriously. More... | |
template<class T , class... Args> | |
detail::_Unique_if< T >::_Single_object | make_unique (Args &&... args) |
Constructs an object of non-array type T and wraps it in a throwing::unique_ptr using args as the parameter list for the constructor of T. More... | |
template<class T > | |
detail::_Unique_if< T >::_Unknown_bound | make_unique (size_t n) |
Constructs an array of unknown bound T and wraps it in a throwing::unique_ptr. More... | |
template<class T , class... Args> | |
detail::_Unique_if< T >::_Known_bound | make_unique (Args &&...)=delete |
Construction of arrays of known bound is disallowed. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator== (const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator!= (const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator< (const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator<= (const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator> (const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator>= (const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator== (const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator!= (const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator< (const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator<= (const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator> (const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator>= (const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator== (const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator!= (const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator< (const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator<= (const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator> (const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T1 , class D1 , class T2 , class D2 > | |
bool | operator>= (const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs) |
Compare two unique_ptr objects. More... | |
template<class T , class D > | |
bool | operator== (const unique_ptr< T, D > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator== (std::nullptr_t lhs, const unique_ptr< T, D > &rhs) TSP_NOEXCEPT |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator!= (const unique_ptr< T, D > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator!= (std::nullptr_t lhs, const unique_ptr< T, D > &rhs) TSP_NOEXCEPT |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator< (const unique_ptr< T, D > &lhs, std::nullptr_t rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator< (std::nullptr_t lhs, const unique_ptr< T, D > &rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator<= (const unique_ptr< T, D > &lhs, std::nullptr_t rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator<= (std::nullptr_t lhs, const unique_ptr< T, D > &rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator> (const unique_ptr< T, D > &lhs, std::nullptr_t rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator> (std::nullptr_t lhs, const unique_ptr< T, D > &rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator>= (const unique_ptr< T, D > &lhs, std::nullptr_t rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class T , class D > | |
bool | operator>= (std::nullptr_t lhs, const unique_ptr< T, D > &rhs) |
Compare a unique_ptr with a null pointer. More... | |
template<class CharT , class Traits , class Y , class D > | |
std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, const unique_ptr< Y, D > &ptr) |
Inserts the value of the pointer stored in ptr into the output stream os. More... | |
template<class T > | |
void | swap (throwing::unique_ptr< T > &lhs, throwing::unique_ptr< T > &rhs) TSP_NOEXCEPT |
Specializes the std::swap algorithm for throwing::unique_ptr. More... | |
Implementations of throwing::shared_ptr, throwing::unique_ptr and related.
shared_ptr<T> throwing::allocate_shared | ( | const Alloc & | alloc, |
Args &&... | args | ||
) |
Constructs an object of type T and wraps it in a throwing::shared_ptr using args as the parameter list for the constructor of T.
The object is constructed as if by the expression std::allocator_traits<A2>::construct(a, pv, v)), where pv is an internal void* pointer to storage suitable to hold an object of type T and a is the possibly-rebound copy of the allocator.
The storage is typically larger than sizeof(T) in order to use one allocation for both the control block of the shared pointer and the T object.
The shared_ptr constructor called by this function enables shared_from_this with a pointer to the newly constructed object of type T.
All memory allocation is done using a copy of alloc, which must satisfy the Allocator requirements.
This overload only participates in overload resolution if T is not an array type
Definition at line 583 of file shared_ptr.hpp.
bool throwing::atomic_compare_exchange_strong | ( | shared_ptr< T > * | p, |
shared_ptr< T > * | expected, | ||
shared_ptr< T > | desired | ||
) |
Equivalent to atomic_compare_exchange_strong_explicit(p, expected, desired, std::memory_order_seq_cst, std::memory_order_seq_cst)
Definition at line 1035 of file shared_ptr.hpp.
bool throwing::atomic_compare_exchange_strong_explicit | ( | shared_ptr< T > * | p, |
shared_ptr< T > * | expected, | ||
shared_ptr< T > | desired, | ||
std::memory_order | success, | ||
std::memory_order | failure | ||
) |
Compares the shared pointers pointed-to by p and expected. If they are equivalent (store the same pointer value, and either share ownership of the same object or are both empty), assigns desired into *p using the memory ordering constraints specified by success and returns true. If they are not equivalent, assigns *p into *expected using the memory ordering constraints specified by failure and returns false.
Definition at line 1051 of file shared_ptr.hpp.
bool throwing::atomic_compare_exchange_weak | ( | shared_ptr< T > * | p, |
shared_ptr< T > * | expected, | ||
shared_ptr< T > | desired | ||
) |
Equivalent to atomic_compare_exchange_weak_explicit(p, expected, desired, std::memory_order_seq_cst, std::memory_order_seq_cst)
Definition at line 1023 of file shared_ptr.hpp.
bool throwing::atomic_compare_exchange_weak_explicit | ( | shared_ptr< T > * | p, |
shared_ptr< T > * | expected, | ||
shared_ptr< T > | desired, | ||
std::memory_order | success, | ||
std::memory_order | failure | ||
) |
Compares the shared pointers pointed-to by p and expected. If they are equivalent (store the same pointer value, and either share ownership of the same object or are both empty), assigns desired into *p using the memory ordering constraints specified by success and returns true. If they are not equivalent, assigns *p into *expected using the memory ordering constraints specified by failure and returns false, but may fail spuriously.
Definition at line 1070 of file shared_ptr.hpp.
shared_ptr<T> throwing::atomic_exchange | ( | shared_ptr< T > * | p, |
shared_ptr< T > | r | ||
) |
Equivalent to atomic_exchange(p, r, memory_order_seq_cst)
Definition at line 1001 of file shared_ptr.hpp.
shared_ptr<T> throwing::atomic_exchange_explicit | ( | shared_ptr< T > * | p, |
shared_ptr< T > | r, | ||
std::memory_order | mo | ||
) |
Stores the shared pointer r in the shared pointer pointed to by p and returns the value formerly pointed-to by p, atomically.
Effectively executes p->swap(r) and returns a copy of r after the swap.
Definition at line 1012 of file shared_ptr.hpp.
bool throwing::atomic_is_lock_free | ( | shared_ptr< T > const * | p | ) |
Determines whether atomic access to the shared pointer pointed-to by p is lock-free.
Definition at line 955 of file shared_ptr.hpp.
shared_ptr<T> throwing::atomic_load | ( | const shared_ptr< T > * | p | ) |
Equivalent to atomic_load_explicit(p, std::memory_order_seq_cst)
Definition at line 961 of file shared_ptr.hpp.
shared_ptr<T> throwing::atomic_load_explicit | ( | const shared_ptr< T > * | p, |
std::memory_order | mo | ||
) |
Returns the shared pointer pointed-to by p.
As with the non-specialized std::atomic_load_explicit, mo cannot be std::memory_order_release or std::memory_order_acq_rel
Definition at line 972 of file shared_ptr.hpp.
void throwing::atomic_store | ( | shared_ptr< T > * | p, |
shared_ptr< T > | r | ||
) |
Equivalent to atomic_store_explicit(p, r, memory_order_seq_cst)
Definition at line 980 of file shared_ptr.hpp.
void throwing::atomic_store_explicit | ( | shared_ptr< T > * | p, |
shared_ptr< T > | r, | ||
std::memory_order | mo | ||
) |
Stores the shared pointer r in the shared pointer pointed-to by p atomically, effectively executing p->swap(r).
As with the non-specialized std::atomic_store_explicit, mo cannot be std::memory_order_acquire or std::memory_order_acq_rel.
Definition at line 992 of file shared_ptr.hpp.
shared_ptr<T> throwing::const_pointer_cast | ( | const shared_ptr< U > & | r | ) |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a const_cast expression.
If r is empty, so is the new shared_ptr (but its stored pointer is not necessarily null).
Otherwise, the new shared_ptr will share ownership with r.
The behavior is undefined unless const_cast<T*>((U*)nullptr) is well formed.
Definition at line 638 of file shared_ptr.hpp.
shared_ptr<T> throwing::dynamic_pointer_cast | ( | const shared_ptr< U > & | r | ) |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a dynamic_cast expression.
If r is empty, so is the new shared_ptr (but its stored pointer is not necessarily null).
Otherwise, the new shared_ptr will share ownership with r, except that it is empty if the dynamic_cast performed by dynamic_pointer_cast returns a null pointer.
The behavior is undefined unless dynamic_cast<T*>((U*)nullptr) is well formed.
Definition at line 618 of file shared_ptr.hpp.
Deleter* throwing::get_deleter | ( | const shared_ptr< T > & | p | ) |
Access to the p's deleter.
If the shared pointer p owns a deleter of type cv-unqualified Deleter (e.g. if it was created with one of the constructors that take a deleter as a parameter), then returns a pointer to the deleter. Otherwise, returns a null pointer.
Definition at line 668 of file shared_ptr.hpp.
shared_ptr<T> throwing::make_shared | ( | Args &&... | args | ) |
Constructs an object of type T and wraps it in a throwing::shared_ptr using args as the parameter list for the constructor of T.
The object is constructed as if by the expression ::new (pv) T(std::forward<Args>(args)...), where pv is an internal void* pointer to storage suitable to hold an object of type T.
The storage is typically larger than sizeof(T) in order to use one allocation for both the control block of the shared pointer and the T object.
The shared_ptr constructor called by this function enables shared_from_this with a pointer to the newly constructed object of type T.
This overload only participates in overload resolution if T is not an array type
Definition at line 557 of file shared_ptr.hpp.
detail::_Unique_if<T>::_Single_object throwing::make_unique | ( | Args &&... | args | ) |
Constructs an object of non-array type T and wraps it in a throwing::unique_ptr using args as the parameter list for the constructor of T.
Equivalent to: unique_ptr<T>(new T(std::forward<Args>(args)...))
This overload only participates in overload resolution if T is not an array type.
Definition at line 694 of file unique_ptr.hpp.
detail::_Unique_if<T>::_Unknown_bound throwing::make_unique | ( | size_t | n | ) |
Constructs an array of unknown bound T and wraps it in a throwing::unique_ptr.
Equivalent to: unique_ptr<T>(new typename std::remove_extent<T>::type[size]())
This overload only participates in overload resolution if T is an array of unknown bound.
Definition at line 708 of file unique_ptr.hpp.
|
delete |
Construction of arrays of known bound is disallowed.
bool throwing::operator!= | ( | const shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator!= | ( | const unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 730 of file unique_ptr.hpp.
bool throwing::operator!= | ( | const std::shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator!= | ( | const std::unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 781 of file unique_ptr.hpp.
bool throwing::operator!= | ( | const shared_ptr< T > & | lhs, |
const std::shared_ptr< U > & | rhs | ||
) |
bool throwing::operator!= | ( | const unique_ptr< T1, D1 > & | lhs, |
const std::unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 837 of file unique_ptr.hpp.
bool throwing::operator!= | ( | const shared_ptr< T > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 860 of file shared_ptr.hpp.
bool throwing::operator!= | ( | std::nullptr_t | lhs, |
const shared_ptr< T > & | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 868 of file shared_ptr.hpp.
bool throwing::operator!= | ( | const unique_ptr< T, D > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 900 of file unique_ptr.hpp.
bool throwing::operator!= | ( | std::nullptr_t | lhs, |
const unique_ptr< T, D > & | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 908 of file unique_ptr.hpp.
bool throwing::operator< | ( | const shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
Compare two shared_ptr objects.
Definition at line 696 of file shared_ptr.hpp.
bool throwing::operator< | ( | const unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 740 of file unique_ptr.hpp.
bool throwing::operator< | ( | const std::shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
Compare two shared_ptr objects.
Definition at line 752 of file shared_ptr.hpp.
bool throwing::operator< | ( | const std::unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 792 of file unique_ptr.hpp.
bool throwing::operator< | ( | const shared_ptr< T > & | lhs, |
const std::shared_ptr< U > & | rhs | ||
) |
Compare two shared_ptr objects.
Definition at line 808 of file shared_ptr.hpp.
bool throwing::operator< | ( | const unique_ptr< T1, D1 > & | lhs, |
const std::unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 848 of file unique_ptr.hpp.
bool throwing::operator< | ( | const shared_ptr< T > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 876 of file shared_ptr.hpp.
bool throwing::operator< | ( | std::nullptr_t | lhs, |
const shared_ptr< T > & | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 884 of file shared_ptr.hpp.
bool throwing::operator< | ( | const unique_ptr< T, D > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 916 of file unique_ptr.hpp.
bool throwing::operator< | ( | std::nullptr_t | lhs, |
const unique_ptr< T, D > & | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 924 of file unique_ptr.hpp.
std::basic_ostream<U, V>& throwing::operator<< | ( | std::basic_ostream< U, V > & | os, |
const shared_ptr< T > & | ptr | ||
) |
Inserts the value of the pointer stored in ptr into the output stream os.
Equivalent to os << ptr.get().
Definition at line 943 of file shared_ptr.hpp.
std::basic_ostream<CharT, Traits>& throwing::operator<< | ( | std::basic_ostream< CharT, Traits > & | os, |
const unique_ptr< Y, D > & | ptr | ||
) |
Inserts the value of the pointer stored in ptr into the output stream os.
Equivalent to os << ptr.get().
Definition at line 984 of file unique_ptr.hpp.
bool throwing::operator<= | ( | const shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator<= | ( | const unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator<= | ( | const std::shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator<= | ( | const std::unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator<= | ( | const shared_ptr< T > & | lhs, |
const std::shared_ptr< U > & | rhs | ||
) |
bool throwing::operator<= | ( | const unique_ptr< T1, D1 > & | lhs, |
const std::unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator<= | ( | const shared_ptr< T > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 908 of file shared_ptr.hpp.
bool throwing::operator<= | ( | std::nullptr_t | lhs, |
const shared_ptr< T > & | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 916 of file shared_ptr.hpp.
bool throwing::operator<= | ( | const unique_ptr< T, D > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 932 of file unique_ptr.hpp.
bool throwing::operator<= | ( | std::nullptr_t | lhs, |
const unique_ptr< T, D > & | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 940 of file unique_ptr.hpp.
bool throwing::operator== | ( | const shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
Compare two shared_ptr objects.
Definition at line 676 of file shared_ptr.hpp.
bool throwing::operator== | ( | const unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 722 of file unique_ptr.hpp.
bool throwing::operator== | ( | const std::shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
Compare two shared_ptr objects.
Definition at line 732 of file shared_ptr.hpp.
bool throwing::operator== | ( | const std::unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 772 of file unique_ptr.hpp.
bool throwing::operator== | ( | const shared_ptr< T > & | lhs, |
const std::shared_ptr< U > & | rhs | ||
) |
Compare two shared_ptr objects.
Definition at line 788 of file shared_ptr.hpp.
bool throwing::operator== | ( | const unique_ptr< T1, D1 > & | lhs, |
const std::unique_ptr< T2, D2 > & | rhs | ||
) |
Compare two unique_ptr objects.
Definition at line 828 of file unique_ptr.hpp.
bool throwing::operator== | ( | const shared_ptr< T > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 844 of file shared_ptr.hpp.
bool throwing::operator== | ( | std::nullptr_t | lhs, |
const shared_ptr< T > & | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 852 of file shared_ptr.hpp.
bool throwing::operator== | ( | const unique_ptr< T, D > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 884 of file unique_ptr.hpp.
bool throwing::operator== | ( | std::nullptr_t | lhs, |
const unique_ptr< T, D > & | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 892 of file unique_ptr.hpp.
bool throwing::operator> | ( | const shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator> | ( | const unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator> | ( | const std::shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator> | ( | const std::unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator> | ( | const shared_ptr< T > & | lhs, |
const std::shared_ptr< U > & | rhs | ||
) |
bool throwing::operator> | ( | const unique_ptr< T1, D1 > & | lhs, |
const std::unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator> | ( | const shared_ptr< T > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 892 of file shared_ptr.hpp.
bool throwing::operator> | ( | std::nullptr_t | lhs, |
const shared_ptr< T > & | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 900 of file shared_ptr.hpp.
bool throwing::operator> | ( | const unique_ptr< T, D > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 948 of file unique_ptr.hpp.
bool throwing::operator> | ( | std::nullptr_t | lhs, |
const unique_ptr< T, D > & | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 956 of file unique_ptr.hpp.
bool throwing::operator>= | ( | const shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator>= | ( | const unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator>= | ( | const std::shared_ptr< T > & | lhs, |
const shared_ptr< U > & | rhs | ||
) |
bool throwing::operator>= | ( | const std::unique_ptr< T1, D1 > & | lhs, |
const unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator>= | ( | const shared_ptr< T > & | lhs, |
const std::shared_ptr< U > & | rhs | ||
) |
bool throwing::operator>= | ( | const unique_ptr< T1, D1 > & | lhs, |
const std::unique_ptr< T2, D2 > & | rhs | ||
) |
bool throwing::operator>= | ( | const shared_ptr< T > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 924 of file shared_ptr.hpp.
bool throwing::operator>= | ( | std::nullptr_t | lhs, |
const shared_ptr< T > & | rhs | ||
) |
Compare a shared_ptr with a null pointer.
Definition at line 932 of file shared_ptr.hpp.
bool throwing::operator>= | ( | const unique_ptr< T, D > & | lhs, |
std::nullptr_t | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 964 of file unique_ptr.hpp.
bool throwing::operator>= | ( | std::nullptr_t | lhs, |
const unique_ptr< T, D > & | rhs | ||
) |
Compare a unique_ptr with a null pointer.
Definition at line 972 of file unique_ptr.hpp.
shared_ptr<T> throwing::reinterpret_pointer_cast | ( | const shared_ptr< U > & | r | ) |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a reinterpret_cast expression.
If r is empty, so is the new shared_ptr (but its stored pointer is not necessarily null).
Otherwise, the new shared_ptr will share ownership with r.
The behavior is undefined unless reinterpret_cast<T*>((U*)nullptr) is well formed.
Definition at line 655 of file shared_ptr.hpp.
shared_ptr<T> throwing::static_pointer_cast | ( | const shared_ptr< U > & | r | ) |
Creates a new instance of shared_ptr whose stored pointer is obtained from r's stored pointer using a static_cast expression.
If r is empty, so is the new shared_ptr (but its stored pointer is not necessarily null).
Otherwise, the new shared_ptr will share ownership with r.
The behavior is undefined unless static_cast<T*>((U*)nullptr) is well formed.
Definition at line 599 of file shared_ptr.hpp.
void throwing::swap | ( | throwing::shared_ptr< T > & | lhs, |
throwing::shared_ptr< T > & | rhs | ||
) |
Specializes the std::swap algorithm for throwing::shared_ptr.
Swaps the pointers of lhs and rhs.
Calls lhs.swap(rhs).
Definition at line 536 of file shared_ptr.hpp.
void throwing::swap | ( | throwing::unique_ptr< T > & | lhs, |
throwing::unique_ptr< T > & | rhs | ||
) |
Specializes the std::swap algorithm for throwing::unique_ptr.
Swaps the pointers of lhs and rhs.
Calls lhs.swap(rhs).
This function does not participate in overload resolution unless std::is_swappable<D>::value is true. (since C++17)
Definition at line 999 of file unique_ptr.hpp.