14 #include <throwing/null_ptr_exception.hpp> 15 #include <throwing/private/compiler_checks.hpp> 97 template <
class Y,
class Deleter>
111 template <
class Deleter>
129 template <
class Y,
class Deleter,
class Alloc>
242 template <
class Y,
class Deleter>
336 template <
class Y,
class Deleter>
381 template <
class Y,
class Deleter>
void reset(Y *ptr, Deleter d) {
400 template <
class Y,
class Deleter,
class Alloc>
401 void reset(Y *ptr, Deleter d, Alloc alloc) {
526 std::shared_ptr<T> p;
582 template <
class T,
class Alloc,
class... Args>
598 template <
class T,
class U>
617 template <
class T,
class U>
637 template <
class T,
class U>
654 template <
class T,
class U>
667 template <
class Deleter,
class T>
675 template <
class T,
class U>
684 template <
class T,
class U>
695 template <
class T,
class U>
704 template <
class T,
class U>
713 template <
class T,
class U>
722 template <
class T,
class U>
731 template <
class T,
class U>
740 template <
class T,
class U>
751 template <
class T,
class U>
760 template <
class T,
class U>
769 template <
class T,
class U>
778 template <
class T,
class U>
787 template <
class T,
class U>
796 template <
class T,
class U>
807 template <
class T,
class U>
816 template <
class T,
class U>
825 template <
class T,
class U>
834 template <
class T,
class U>
942 template <
class T,
class U,
class V>
943 std::basic_ostream<U, V> &operator<<(
std::basic_ostream<U, V> &os,
949 #if !(!defined(__clang__
) && defined(__GNUC__) && 973 std::memory_order mo) {
993 std::memory_order mo) {
1013 std::memory_order mo) {
1054 std::memory_order success,
1055 std::memory_order failure) {
1073 std::memory_order success,
1074 std::memory_order failure) {
1090 return std::hash<
typename throwing::shared_ptr<T>::element_type *>()(
1097 #include <throwing/private/clear_compiler_checks.hpp> bool operator<=(const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
shared_ptr(std::shared_ptr< T > &&r) TSP_NOEXCEPT
Move-constructs a shared_ptr from r.
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.
shared_ptr(Y *ptr, Deleter d)
Constructs a shared_ptr with ptr as the pointer to the managed object.
bool operator>=(const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
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...
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...
bool operator>=(const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
shared_ptr< T > atomic_exchange(shared_ptr< T > *p, shared_ptr< T > r)
Equivalent to atomic_exchange(p, r, memory_order_seq_cst)
shared_ptr(std::shared_ptr< Y > &&r) TSP_NOEXCEPT
Move-constructs a shared_ptr from r.
bool operator==(const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
bool operator<(const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
bool operator!=(const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
shared_ptr & operator=(std::unique_ptr< Y, Deleter > &&r)
Assignment operator.
shared_ptr & operator=(shared_ptr< Y > &&r) TSP_NOEXCEPT
Assignment operator.
bool operator>=(const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
shared_ptr & operator=(shared_ptr &&r) TSP_NOEXCEPT
Assignment operator.
bool operator!=(const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
shared_ptr(Y *ptr)
Constructs a shared_ptr with ptr as the pointer to the managed object.
Deleter * get_deleter(const shared_ptr< T > &p) TSP_NOEXCEPT
Access to the p's deleter.
shared_ptr(std::unique_ptr< Y, Deleter > &&r)
Constructs a shared_ptr which manages the object currently managed by r.
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...
shared_ptr< T > atomic_load_explicit(const shared_ptr< T > *p, std::memory_order mo)
Returns the shared pointer pointed-to by p.
bool operator<(const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
shared_ptr(shared_ptr &&r) TSP_NOEXCEPT
Move-constructs a shared_ptr from r.
operator bool() const TSP_NOEXCEPT
Checks if *this stores a non-null pointer, i.e. whether get() != nullptr.
const std::shared_ptr< T > & get_std_shared_ptr() const TSP_NOEXCEPT
Returns the underlying std::shared_pointer.
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...
shared_ptr & operator=(const shared_ptr< Y > &r) TSP_NOEXCEPT
Assignment operator.
bool operator==(std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
bool operator>=(std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
std::shared_ptr< T >::element_type element_type
the type pointed to.
size_t operator()(const throwing::shared_ptr< T > &x) const
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)
shared_ptr(const shared_ptr &r) TSP_NOEXCEPT
Constructs a shared_ptr which shares ownership of the object managed by r.
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...
long use_count() const TSP_NOEXCEPT
Returns the number of different shared_ptr instances (this included) managing the current object...
bool operator!=(const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
Wrapper aroung std::shared_ptr that throws when a wrapped null pointer is dereferenced.
bool operator!=(const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
shared_ptr(Y *ptr, Deleter d, Alloc alloc)
Constructs a shared_ptr with ptr as the pointer to the managed object.
bool operator>=(const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
bool owner_before(const shared_ptr< Y > &other) const TSP_NOEXCEPT
Checks whether this shared_ptr precedes other in implementation defined owner-based (as opposed to va...
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...
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...
bool operator==(const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
bool operator<=(std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
bool operator!=(std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
Implementations of throwing::shared_ptr, throwing::unique_ptr and related.
bool owner_before(const std::shared_ptr< Y > &other) const TSP_NOEXCEPT
Checks whether this shared_ptr precedes other in implementation defined owner-based (as opposed to va...
~shared_ptr()=default
Destructor If *this owns an object and it is the last shared_ptr owning it, the object is destroyed t...
element_type * get() const TSP_NOEXCEPT
Returns the stored pointer.
shared_ptr< T > atomic_load(const shared_ptr< T > *p)
Equivalent to atomic_load_explicit(p, std::memory_order_seq_cst)
bool operator<=(const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
bool operator>(const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
#define TSP_ARRAY_SUPPORT
bool operator==(const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
T & operator*() const
Dereferences the stored pointer.
void swap(shared_ptr &r) TSP_NOEXCEPT
Exchanges the contents of *this and r.
TSP_CONSTEXPR shared_ptr(std::nullptr_t ptr) TSP_NOEXCEPT
Constructs a shared_ptr with no managed object, i.e. empty shared_ptr.
shared_ptr(const shared_ptr< Y > &r, element_type *ptr) TSP_NOEXCEPT
The aliasing constructor.
bool operator>(std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
shared_ptr(const shared_ptr< Y > &r) TSP_NOEXCEPT
Constructs a shared_ptr which shares ownership of the object managed by r.
bool owner_before(const std::weak_ptr< Y > &other) const TSP_NOEXCEPT
Checks whether this shared_ptr precedes other in implementation defined owner-based (as opposed to va...
shared_ptr(const std::shared_ptr< T > &r) TSP_NOEXCEPT
Constructs a shared_ptr which shares ownership of the object managed by r.
shared_ptr(const std::shared_ptr< Y > &r) TSP_NOEXCEPT
Constructs a shared_ptr which shares ownership of the object managed by r.
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...
T * operator->() const
Dereferences the stored pointer.
shared_ptr(std::nullptr_t ptr, Deleter d)
Constructs a shared_ptr with ptr as the pointer to the managed object.
bool operator<(const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
void reset(Y *ptr, Deleter d)
Replaces the managed object with an object pointed to by ptr.
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 lis...
bool operator<=(const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
void reset(Y *ptr)
Replaces the managed object with an object pointed to by ptr.
bool operator>(const shared_ptr< T > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.
TSP_CONSTEXPR shared_ptr() TSP_NOEXCEPT=default
Constructs a shared_ptr with no managed object, i.e. empty shared_ptr.
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 lis...
void swap(throwing::shared_ptr< T > &lhs, throwing::shared_ptr< T > &rhs) TSP_NOEXCEPT
Specializes the std::swap algorithm for throwing::shared_ptr.
bool operator>(const shared_ptr< T > &lhs, const std::shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
shared_ptr(const std::weak_ptr< Y > &r)
Constructs a shared_ptr which shares ownership of the object managed by r.
void atomic_store(shared_ptr< T > *p, shared_ptr< T > r)
Equivalent to atomic_store_explicit(p, r, memory_order_seq_cst)
shared_ptr & operator=(const shared_ptr &r) TSP_NOEXCEPT
Assignment operator.
std::shared_ptr< T > & get_std_shared_ptr() TSP_NOEXCEPT
Returns the underlying std::shared_pointer.
bool operator>(const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
bool operator<(const std::shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
bool operator==(const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
void reset(Y *ptr, Deleter d, Alloc alloc)
Replaces the managed object with an object pointed to by ptr.
void reset() TSP_NOEXCEPT
Releases the ownership of the managed object, if any.
shared_ptr(shared_ptr< Y > &&r) TSP_NOEXCEPT
Move-constructs a shared_ptr from r.
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...
bool operator<=(const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) TSP_NOEXCEPT
Compare two shared_ptr objects.
bool operator<(std::nullptr_t lhs, const shared_ptr< T > &rhs) TSP_NOEXCEPT
Compare a shared_ptr with a null pointer.