throwing_ptr
Smart pointers that throw on dereference if null
Classes | Namespaces | Functions
shared_ptr.hpp File Reference

throwing::shared_ptr implementation More...

Go to the source code of this file.

Classes

class  throwing::shared_ptr< T >
 Wrapper aroung std::shared_ptr that throws when a wrapped null pointer is dereferenced. More...
 
struct  std::hash< throwing::shared_ptr< T > >
 Template specialization of std::hash for throwing::shared_ptr<T> More...
 

Namespaces

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

Functions

template<class T >
void throwing::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 > 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. More...
 
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. More...
 
template<class T , class U >
shared_ptr< T > throwing::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 > throwing::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 > throwing::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 > throwing::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 * throwing::get_deleter (const shared_ptr< T > &p) TSP_NOEXCEPT
 Access to the p's deleter. More...
 
template<class T , class U >
bool throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::operator>= (const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT
 Compare two shared_ptr objects. More...
 
template<class T >
bool throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 throwing::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 > & 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. More...
 
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. More...
 
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) More...
 
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. More...
 
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) More...
 
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). More...
 
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) More...
 
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. More...
 
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) More...
 
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) More...
 
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. More...
 
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. More...
 

Detailed Description

throwing::shared_ptr implementation

throwing/shared_ptr.hpp

Definition in file shared_ptr.hpp.