throwing_ptr
Smart pointers that throw on dereference if null
Namespaces | Classes | Functions
throwing Namespace Reference

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...
 

Detailed Description

Implementations of throwing::shared_ptr, throwing::unique_ptr and related.

Function Documentation

◆ allocate_shared()

template<class T , class Alloc , class... Args>
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.

583  {
584  return shared_ptr<T>(std::move(
585  std::allocate_shared<T>(alloc, std::forward<Args>(args)...)));
586 }

◆ atomic_compare_exchange_strong()

template<class T >
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.

1036  {
1038  reinterpret_cast<std::shared_ptr<T> *>(p),
1039  reinterpret_cast<std::shared_ptr<T> *>(expected),
1040  desired.get_std_shared_ptr());
1041 }
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...

◆ atomic_compare_exchange_strong_explicit()

template<class T >
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.

1055  {
1057  reinterpret_cast<std::shared_ptr<T> *>(p),
1058  reinterpret_cast<std::shared_ptr<T> *>(expected),
1059  desired.get_std_shared_ptr(), success, failure);
1060 }
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 poi...

◆ atomic_compare_exchange_weak()

template<class T >
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.

1024  {
1026  reinterpret_cast<std::shared_ptr<T> *>(p),
1027  reinterpret_cast<std::shared_ptr<T> *>(expected),
1028  desired.get_std_shared_ptr());
1029 }
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)

◆ atomic_compare_exchange_weak_explicit()

template<class T >
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.

1074  {
1076  reinterpret_cast<std::shared_ptr<T> *>(p),
1077  reinterpret_cast<std::shared_ptr<T> *>(expected),
1078  desired.get_std_shared_ptr(), success, failure);
1079 }
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 poi...

◆ atomic_exchange()

template<class T >
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.

1001  {
1002  return std::move(atomic_exchange(reinterpret_cast<std::shared_ptr<T> *>(p),
1003  r.get_std_shared_ptr()));
1004 }
shared_ptr< T > atomic_exchange(shared_ptr< T > *p, shared_ptr< T > r)
Equivalent to atomic_exchange(p, r, memory_order_seq_cst)

◆ atomic_exchange_explicit()

template<class T >
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.

1013  {
1014  return std::move(
1015  atomic_exchange_explicit(reinterpret_cast<std::shared_ptr<T> *>(p),
1016  r.get_std_shared_ptr(), mo));
1017 }
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 poin...

◆ atomic_is_lock_free()

template<class T >
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.

955  {
956  return atomic_is_lock_free(reinterpret_cast<std::shared_ptr<T> const *>(p));
957 }
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.
Definition: shared_ptr.hpp:955

◆ atomic_load()

template<class T >
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.

961  {
962  return std::move(
963  atomic_load(reinterpret_cast<const std::shared_ptr<T> *>(p)));
964 }
shared_ptr< T > atomic_load(const shared_ptr< T > *p)
Equivalent to atomic_load_explicit(p, std::memory_order_seq_cst)
Definition: shared_ptr.hpp:961

◆ atomic_load_explicit()

template<class T >
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.

973  {
974  return std::move(atomic_load_explicit(
975  reinterpret_cast<const std::shared_ptr<T> *>(p), mo));
976 }
shared_ptr< T > atomic_load_explicit(const shared_ptr< T > *p, std::memory_order mo)
Returns the shared pointer pointed-to by p.
Definition: shared_ptr.hpp:972

◆ atomic_store()

template<class T >
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.

980  {
981  atomic_store(reinterpret_cast<std::shared_ptr<T> *>(p),
982  r.get_std_shared_ptr());
983 }
void atomic_store(shared_ptr< T > *p, shared_ptr< T > r)
Equivalent to atomic_store_explicit(p, r, memory_order_seq_cst)
Definition: shared_ptr.hpp:980

◆ atomic_store_explicit()

template<class T >
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.

993  {
994  atomic_store_explicit(reinterpret_cast<std::shared_ptr<T> *>(p),
995  r.get_std_shared_ptr(), mo);
996 }
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...
Definition: shared_ptr.hpp:992

◆ const_pointer_cast()

template<class T , class U >
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.

638  {
639  auto p = const_cast<typename shared_ptr<T>::element_type *>(r.get());
640  return shared_ptr<T>(r, p);
641 }

◆ dynamic_pointer_cast()

template<class T , class U >
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.

618  {
619  if (auto p =
620  dynamic_cast<typename shared_ptr<T>::element_type *>(r.get())) {
621  return shared_ptr<T>(r, p);
622  } else {
623  return shared_ptr<T>();
624  }
625 }

◆ get_deleter()

template<class Deleter , class T >
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.

668  {
669  return std::get_deleter<Deleter>(p.get_std_shared_ptr());
670 }

◆ make_shared()

template<class T , class... Args>
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.

557  {
558  return shared_ptr<T>(
559  std::move(std::make_shared<T>(std::forward<Args>(args)...)));
560 }

◆ make_unique() [1/3]

template<class T , class... Args>
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.

694  {
695  return unique_ptr<T>(new T(std::forward<Args>(args)...));
696 }

◆ make_unique() [2/3]

template<class T >
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.

708  {
709  typedef typename std::remove_extent<T>::type U;
710  return unique_ptr<T>(new U[n]());
711 }

◆ make_unique() [3/3]

template<class T , class... Args>
detail::_Unique_if<T>::_Known_bound throwing::make_unique ( Args &&  ...)
delete

Construction of arrays of known bound is disallowed.

◆ operator!=() [1/10]

template<class T , class U >
bool throwing::operator!= ( const shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(lhs == rhs)

Definition at line 685 of file shared_ptr.hpp.

686  {
687  return lhs.get_std_shared_ptr() != rhs.get_std_shared_ptr();
688 }

◆ operator!=() [2/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator!= ( const unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(lhs.get() == rhs.get())

Definition at line 730 of file unique_ptr.hpp.

730  {
731  return lhs.get_std_unique_ptr() != rhs.get_std_unique_ptr();
732 }

◆ operator!=() [3/10]

template<class T , class U >
bool throwing::operator!= ( const std::shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(lhs == rhs)

Definition at line 741 of file shared_ptr.hpp.

742  {
743  return lhs != rhs.get_std_shared_ptr();
744 }

◆ operator!=() [4/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator!= ( const std::unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(lhs.get() == rhs.get())

Definition at line 781 of file unique_ptr.hpp.

782  {
783  return lhs != rhs.get_std_unique_ptr();
784 }

◆ operator!=() [5/10]

template<class T , class U >
bool throwing::operator!= ( const shared_ptr< T > &  lhs,
const std::shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(lhs == rhs)

Definition at line 797 of file shared_ptr.hpp.

798  {
799  return lhs.get_std_shared_ptr() != rhs;
800 }

◆ operator!=() [6/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator!= ( const unique_ptr< T1, D1 > &  lhs,
const std::unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(lhs.get() == rhs.get())

Definition at line 837 of file unique_ptr.hpp.

838  {
839  return lhs.get_std_unique_ptr() != rhs;
840 }

◆ operator!=() [7/10]

template<class T >
bool throwing::operator!= ( const shared_ptr< T > &  lhs,
std::nullptr_t  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
(bool)lhs

Definition at line 860 of file shared_ptr.hpp.

860  {
861  return lhs.get_std_shared_ptr() != rhs;
862 }

◆ operator!=() [8/10]

template<class T >
bool throwing::operator!= ( std::nullptr_t  lhs,
const shared_ptr< T > &  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
(bool)rhs

Definition at line 868 of file shared_ptr.hpp.

868  {
869  return lhs != rhs.get_std_shared_ptr();
870 }

◆ operator!=() [9/10]

template<class T , class D >
bool throwing::operator!= ( const unique_ptr< T, D > &  lhs,
std::nullptr_t  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
(bool)lhs

Definition at line 900 of file unique_ptr.hpp.

900  {
901  return lhs.get_std_unique_ptr() != rhs;
902 }

◆ operator!=() [10/10]

template<class T , class D >
bool throwing::operator!= ( std::nullptr_t  lhs,
const unique_ptr< T, D > &  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
(bool)rhs

Definition at line 908 of file unique_ptr.hpp.

908  {
909  return lhs != rhs.get_std_unique_ptr();
910 }

◆ operator<() [1/10]

template<class T , class U >
bool throwing::operator< ( const shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
std::less<V>()(lhs.get(), rhs.get()), where V is the composite pointer type of std::shared_ptr<T>::element_type* and std::shared_ptr<U>::element_type*

Definition at line 696 of file shared_ptr.hpp.

697  {
698  return lhs.get_std_shared_ptr() < rhs.get_std_shared_ptr();
699 }

◆ operator<() [2/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator< ( const unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
std::less<CT>()(lhs.get(), rhs.get()), where CT is std::common_type<unique_ptr<T1, D1>::pointer, unique_ptr<T2, D2>::pointer>::type

Definition at line 740 of file unique_ptr.hpp.

740  {
741  return lhs.get_std_unique_ptr() < rhs.get_std_unique_ptr();
742 }

◆ operator<() [3/10]

template<class T , class U >
bool throwing::operator< ( const std::shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
std::less<V>()(lhs.get(), rhs.get()), where V is the composite pointer type of std::shared_ptr<T>::element_type* and std::shared_ptr<U>::element_type*

Definition at line 752 of file shared_ptr.hpp.

753  {
754  return lhs < rhs.get_std_shared_ptr();
755 }

◆ operator<() [4/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator< ( const std::unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
std::less<CT>()(lhs.get(), rhs.get()), where CT is std::common_type<unique_ptr<T1, D1>::pointer, unique_ptr<T2,D2>::pointer>::type

Definition at line 792 of file unique_ptr.hpp.

793  {
794  return lhs < rhs.get_std_unique_ptr();
795 }

◆ operator<() [5/10]

template<class T , class U >
bool throwing::operator< ( const shared_ptr< T > &  lhs,
const std::shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
std::less<V>()(lhs.get(), rhs.get()), where V is the composite pointer type of std::shared_ptr<T>::element_type* and std::shared_ptr<U>::element_type*

Definition at line 808 of file shared_ptr.hpp.

809  {
810  return lhs.get_std_shared_ptr() < rhs;
811 }

◆ operator<() [6/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator< ( const unique_ptr< T1, D1 > &  lhs,
const std::unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
std::less<CT>()(lhs.get(), rhs.get()), where CT is std::common_type<unique_ptr<T1, D1>::pointer, unique_ptr<T2,D2>::pointer>::type

Definition at line 848 of file unique_ptr.hpp.

849  {
850  return lhs.get_std_unique_ptr() < rhs;
851 }

◆ operator<() [7/10]

template<class T >
bool throwing::operator< ( const shared_ptr< T > &  lhs,
std::nullptr_t  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
std::less<shared_ptr<T>::element_type*>()(lhs.get(), nullptr)

Definition at line 876 of file shared_ptr.hpp.

876  {
877  return lhs.get_std_shared_ptr() < rhs;
878 }

◆ operator<() [8/10]

template<class T >
bool throwing::operator< ( std::nullptr_t  lhs,
const shared_ptr< T > &  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
std::less<shared_ptr<T>::element_type*>()(nullptr, rhs.get())

Definition at line 884 of file shared_ptr.hpp.

884  {
885  return lhs < rhs.get_std_shared_ptr();
886 }

◆ operator<() [9/10]

template<class T , class D >
bool throwing::operator< ( const unique_ptr< T, D > &  lhs,
std::nullptr_t  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
std::less<unique_ptr<T,D>::pointer>()(lhs.get(), nullptr)

Definition at line 916 of file unique_ptr.hpp.

916  {
917  return lhs.get_std_unique_ptr() < rhs;
918 }

◆ operator<() [10/10]

template<class T , class D >
bool throwing::operator< ( std::nullptr_t  lhs,
const unique_ptr< T, D > &  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
std::less<unique_ptr<T,D>::pointer>()(nullptr, rhs.get())

Definition at line 924 of file unique_ptr.hpp.

924  {
925  return lhs < rhs.get_std_unique_ptr();
926 }

◆ operator<<() [1/2]

template<class T , class U , class V >
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().

Returns
os

Definition at line 943 of file shared_ptr.hpp.

944  {
945  os << ptr.get();
946  return os;
947 }

◆ operator<<() [2/2]

template<class CharT , class Traits , class Y , class D >
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().

Returns
os

Definition at line 984 of file unique_ptr.hpp.

984  {
985  os << ptr.get();
986  return os;
987 }

◆ operator<=() [1/10]

template<class T , class U >
bool throwing::operator<= ( const shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(rhs < lhs)

Definition at line 714 of file shared_ptr.hpp.

715  {
716  return lhs.get_std_shared_ptr() <= rhs.get_std_shared_ptr();
717 }

◆ operator<=() [2/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator<= ( const unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(rhs < lhs)

Definition at line 748 of file unique_ptr.hpp.

748  {
749  return lhs.get_std_unique_ptr() <= rhs.get_std_unique_ptr();
750 }

◆ operator<=() [3/10]

template<class T , class U >
bool throwing::operator<= ( const std::shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(rhs < lhs)

Definition at line 770 of file shared_ptr.hpp.

771  {
772  return lhs <= rhs.get_std_shared_ptr();
773 }

◆ operator<=() [4/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator<= ( const std::unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(rhs < lhs)

Definition at line 801 of file unique_ptr.hpp.

802  {
803  return lhs <= rhs.get_std_unique_ptr();
804 }

◆ operator<=() [5/10]

template<class T , class U >
bool throwing::operator<= ( const shared_ptr< T > &  lhs,
const std::shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(rhs < lhs)

Definition at line 826 of file shared_ptr.hpp.

827  {
828  return lhs.get_std_shared_ptr() <= rhs;
829 }

◆ operator<=() [6/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator<= ( const unique_ptr< T1, D1 > &  lhs,
const std::unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(rhs < lhs)

Definition at line 857 of file unique_ptr.hpp.

858  {
859  return lhs.get_std_unique_ptr() <= rhs;
860 }

◆ operator<=() [7/10]

template<class T >
bool throwing::operator<= ( const shared_ptr< T > &  lhs,
std::nullptr_t  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
!(nullptr < lhs)

Definition at line 908 of file shared_ptr.hpp.

908  {
909  return lhs.get_std_shared_ptr() <= rhs;
910 }

◆ operator<=() [8/10]

template<class T >
bool throwing::operator<= ( std::nullptr_t  lhs,
const shared_ptr< T > &  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
!(rhs < nullptr)

Definition at line 916 of file shared_ptr.hpp.

916  {
917  return lhs <= rhs.get_std_shared_ptr();
918 }

◆ operator<=() [9/10]

template<class T , class D >
bool throwing::operator<= ( const unique_ptr< T, D > &  lhs,
std::nullptr_t  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
!(nullptr < lhs)

Definition at line 932 of file unique_ptr.hpp.

932  {
933  return lhs.get_std_unique_ptr() <= rhs;
934 }

◆ operator<=() [10/10]

template<class T , class D >
bool throwing::operator<= ( std::nullptr_t  lhs,
const unique_ptr< T, D > &  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
!(rhs < nullptr)

Definition at line 940 of file unique_ptr.hpp.

940  {
941  return lhs <= rhs.get_std_unique_ptr();
942 }

◆ operator==() [1/10]

template<class T , class U >
bool throwing::operator== ( const shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
lhs.get() == rhs.get()

Definition at line 676 of file shared_ptr.hpp.

677  {
678  return lhs.get_std_shared_ptr() == rhs.get_std_shared_ptr();
679 }

◆ operator==() [2/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator== ( const unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
lhs.get() == rhs.get()

Definition at line 722 of file unique_ptr.hpp.

722  {
723  return lhs.get_std_unique_ptr() == rhs.get_std_unique_ptr();
724 }

◆ operator==() [3/10]

template<class T , class U >
bool throwing::operator== ( const std::shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
lhs.get() == rhs.get()

Definition at line 732 of file shared_ptr.hpp.

733  {
734  return lhs == rhs.get_std_shared_ptr();
735 }

◆ operator==() [4/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator== ( const std::unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
lhs.get() == rhs.get()

Definition at line 772 of file unique_ptr.hpp.

773  {
774  return lhs == rhs.get_std_unique_ptr();
775 }

◆ operator==() [5/10]

template<class T , class U >
bool throwing::operator== ( const shared_ptr< T > &  lhs,
const std::shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
lhs.get() == rhs.get()

Definition at line 788 of file shared_ptr.hpp.

789  {
790  return lhs.get_std_shared_ptr() == rhs;
791 }

◆ operator==() [6/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator== ( const unique_ptr< T1, D1 > &  lhs,
const std::unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
lhs.get() == rhs.get()

Definition at line 828 of file unique_ptr.hpp.

829  {
830  return lhs.get_std_unique_ptr() == rhs;
831 }

◆ operator==() [7/10]

template<class T >
bool throwing::operator== ( const shared_ptr< T > &  lhs,
std::nullptr_t  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
!lhs

Definition at line 844 of file shared_ptr.hpp.

844  {
845  return lhs.get_std_shared_ptr() == rhs;
846 }

◆ operator==() [8/10]

template<class T >
bool throwing::operator== ( std::nullptr_t  lhs,
const shared_ptr< T > &  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
!rhs

Definition at line 852 of file shared_ptr.hpp.

852  {
853  return lhs == rhs.get_std_shared_ptr();
854 }

◆ operator==() [9/10]

template<class T , class D >
bool throwing::operator== ( const unique_ptr< T, D > &  lhs,
std::nullptr_t  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
!lhs

Definition at line 884 of file unique_ptr.hpp.

884  {
885  return lhs.get_std_unique_ptr() == rhs;
886 }

◆ operator==() [10/10]

template<class T , class D >
bool throwing::operator== ( std::nullptr_t  lhs,
const unique_ptr< T, D > &  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
!rhs

Definition at line 892 of file unique_ptr.hpp.

892  {
893  return lhs == rhs.get_std_unique_ptr();
894 }

◆ operator>() [1/10]

template<class T , class U >
bool throwing::operator> ( const shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
rhs < lhs

Definition at line 705 of file shared_ptr.hpp.

706  {
707  return lhs.get_std_shared_ptr() > rhs.get_std_shared_ptr();
708 }

◆ operator>() [2/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator> ( const unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
rhs < lhs

Definition at line 756 of file unique_ptr.hpp.

756  {
757  return lhs.get_std_unique_ptr() > rhs.get_std_unique_ptr();
758 }

◆ operator>() [3/10]

template<class T , class U >
bool throwing::operator> ( const std::shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
rhs < lhs

Definition at line 761 of file shared_ptr.hpp.

762  {
763  return lhs > rhs.get_std_shared_ptr();
764 }

◆ operator>() [4/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator> ( const std::unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
rhs < lhs

Definition at line 810 of file unique_ptr.hpp.

811  {
812  return lhs > rhs.get_std_unique_ptr();
813 }

◆ operator>() [5/10]

template<class T , class U >
bool throwing::operator> ( const shared_ptr< T > &  lhs,
const std::shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
rhs < lhs

Definition at line 817 of file shared_ptr.hpp.

818  {
819  return lhs.get_std_shared_ptr() > rhs;
820 }

◆ operator>() [6/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator> ( const unique_ptr< T1, D1 > &  lhs,
const std::unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
rhs < lhs

Definition at line 866 of file unique_ptr.hpp.

867  {
868  return lhs.get_std_unique_ptr() > rhs;
869 }

◆ operator>() [7/10]

template<class T >
bool throwing::operator> ( const shared_ptr< T > &  lhs,
std::nullptr_t  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
nullptr < lhs

Definition at line 892 of file shared_ptr.hpp.

892  {
893  return lhs.get_std_shared_ptr() > rhs;
894 }

◆ operator>() [8/10]

template<class T >
bool throwing::operator> ( std::nullptr_t  lhs,
const shared_ptr< T > &  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
rhs < nullptr

Definition at line 900 of file shared_ptr.hpp.

900  {
901  return lhs > rhs.get_std_shared_ptr();
902 }

◆ operator>() [9/10]

template<class T , class D >
bool throwing::operator> ( const unique_ptr< T, D > &  lhs,
std::nullptr_t  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
nullptr < lhs

Definition at line 948 of file unique_ptr.hpp.

948  {
949  return lhs.get_std_unique_ptr() > rhs;
950 }

◆ operator>() [10/10]

template<class T , class D >
bool throwing::operator> ( std::nullptr_t  lhs,
const unique_ptr< T, D > &  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
rhs < nullptr

Definition at line 956 of file unique_ptr.hpp.

956  {
957  return lhs > rhs.get_std_unique_ptr();
958 }

◆ operator>=() [1/10]

template<class T , class U >
bool throwing::operator>= ( const shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(lhs < rhs)

Definition at line 723 of file shared_ptr.hpp.

724  {
725  return lhs.get_std_shared_ptr() >= rhs.get_std_shared_ptr();
726 }

◆ operator>=() [2/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator>= ( const unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(lhs < rhs)

Definition at line 764 of file unique_ptr.hpp.

764  {
765  return lhs.get_std_unique_ptr() >= rhs.get_std_unique_ptr();
766 }

◆ operator>=() [3/10]

template<class T , class U >
bool throwing::operator>= ( const std::shared_ptr< T > &  lhs,
const shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(lhs < rhs)

Definition at line 779 of file shared_ptr.hpp.

780  {
781  return lhs >= rhs.get_std_shared_ptr();
782 }

◆ operator>=() [4/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator>= ( const std::unique_ptr< T1, D1 > &  lhs,
const unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(lhs < rhs)

Definition at line 819 of file unique_ptr.hpp.

820  {
821  return lhs >= rhs.get_std_unique_ptr();
822 }

◆ operator>=() [5/10]

template<class T , class U >
bool throwing::operator>= ( const shared_ptr< T > &  lhs,
const std::shared_ptr< U > &  rhs 
)

Compare two shared_ptr objects.

Returns
!(lhs < rhs)

Definition at line 835 of file shared_ptr.hpp.

836  {
837  return lhs.get_std_shared_ptr() >= rhs;
838 }

◆ operator>=() [6/10]

template<class T1 , class D1 , class T2 , class D2 >
bool throwing::operator>= ( const unique_ptr< T1, D1 > &  lhs,
const std::unique_ptr< T2, D2 > &  rhs 
)

Compare two unique_ptr objects.

Returns
!(lhs < rhs)

Definition at line 875 of file unique_ptr.hpp.

876  {
877  return lhs.get_std_unique_ptr() >= rhs;
878 }

◆ operator>=() [7/10]

template<class T >
bool throwing::operator>= ( const shared_ptr< T > &  lhs,
std::nullptr_t  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
!(lhs < nullptr)

Definition at line 924 of file shared_ptr.hpp.

924  {
925  return lhs.get_std_shared_ptr() >= rhs;
926 }

◆ operator>=() [8/10]

template<class T >
bool throwing::operator>= ( std::nullptr_t  lhs,
const shared_ptr< T > &  rhs 
)

Compare a shared_ptr with a null pointer.

Returns
!(nullptr < rhs)

Definition at line 932 of file shared_ptr.hpp.

932  {
933  return lhs >= rhs.get_std_shared_ptr();
934 }

◆ operator>=() [9/10]

template<class T , class D >
bool throwing::operator>= ( const unique_ptr< T, D > &  lhs,
std::nullptr_t  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
!(lhs < nullptr)

Definition at line 964 of file unique_ptr.hpp.

964  {
965  return lhs.get_std_unique_ptr() >= rhs;
966 }

◆ operator>=() [10/10]

template<class T , class D >
bool throwing::operator>= ( std::nullptr_t  lhs,
const unique_ptr< T, D > &  rhs 
)

Compare a unique_ptr with a null pointer.

Returns
!(nullptr < rhs)

Definition at line 972 of file unique_ptr.hpp.

972  {
973  return lhs >= rhs.get_std_unique_ptr();
974 }

◆ reinterpret_pointer_cast()

template<class T , class U >
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.

655  {
656  auto p = reinterpret_cast<typename shared_ptr<T>::element_type *>(r.get());
657  return shared_ptr<T>(r, p);
658 }

◆ static_pointer_cast()

template<class T , class U >
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.

599  {
600  auto p = static_cast<typename shared_ptr<T>::element_type *>(r.get());
601  return shared_ptr<T>(r, p);
602 }

◆ swap() [1/2]

template<class T >
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.

537  {
538  lhs.swap(rhs);
539 }
void swap(shared_ptr &r) TSP_NOEXCEPT
Exchanges the contents of *this and r.
Definition: shared_ptr.hpp:344

◆ swap() [2/2]

template<class T >
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.

1000  {
1002 }
std_unique_ptr_type & get_std_unique_ptr() TSP_NOEXCEPT
Returns reference to the wrapped std::unique_ptr.
Definition: unique_ptr.hpp:297
void swap(throwing::unique_ptr< T > &lhs, throwing::unique_ptr< T > &rhs) TSP_NOEXCEPT
Specializes the std::swap algorithm for throwing::unique_ptr.
Definition: unique_ptr.hpp:999