12 #include <throwing/null_ptr_exception.hpp> 13 #include <throwing/private/compiler_checks.hpp> 37 template <
typename T,
typename Deleter =
std::default_delete<T>>
88 typename std::conditional<
std::is_reference<Deleter>::value,
89 Deleter,
const Deleter &>::type d1)
126 template <
class U,
class E>
147 template <
class U,
class E>
191 template <
class U,
class E>
213 template <
class U,
class E>
279 if (
nullptr ==
get())
328 template <
typename T,
typename Deleter>
class unique_ptr<T[], Deleter> {
399 typename std::conditional<
std::is_reference<Deleter>::value,
400 Deleter,
const Deleter &>::type d1)
450 template <
class U,
class E>
475 template <
class U,
class E>
523 template <
class U,
class E>
549 template <
class U,
class E>
657 std::unique_ptr<T[], Deleter> p;
693 template <
class T,
class... Args>
715 template <
class T,
class... Args>
721 template <
class T1,
class D1,
class T2,
class D2>
729 template <
class T1,
class D1,
class T2,
class D2>
739 template <
class T1,
class D1,
class T2,
class D2>
747 template <
class T1,
class D1,
class T2,
class D2>
755 template <
class T1,
class D1,
class T2,
class D2>
763 template <
class T1,
class D1,
class T2,
class D2>
771 template <
class T1,
class D1,
class T2,
class D2>
780 template <
class T1,
class D1,
class T2,
class D2>
791 template <
class T1,
class D1,
class T2,
class D2>
800 template <
class T1,
class D1,
class T2,
class D2>
809 template <
class T1,
class D1,
class T2,
class D2>
818 template <
class T1,
class D1,
class T2,
class D2>
827 template <
class T1,
class D1,
class T2,
class D2>
829 const std::unique_ptr<T2, D2> &rhs) {
836 template <
class T1,
class D1,
class T2,
class D2>
838 const std::unique_ptr<T2, D2> &rhs) {
847 template <
class T1,
class D1,
class T2,
class D2>
849 const std::unique_ptr<T2, D2> &rhs) {
856 template <
class T1,
class D1,
class T2,
class D2>
858 const std::unique_ptr<T2, D2> &rhs) {
865 template <
class T1,
class D1,
class T2,
class D2>
867 const std::unique_ptr<T2, D2> &rhs) {
874 template <
class T1,
class D1,
class T2,
class D2>
876 const std::unique_ptr<T2, D2> &rhs) {
883 template <
class T,
class D>
891 template <
class T,
class D>
899 template <
class T,
class D>
907 template <
class T,
class D>
915 template <
class T,
class D>
923 template <
class T,
class D>
931 template <
class T,
class D>
939 template <
class T,
class D>
947 template <
class T,
class D>
955 template <
class T,
class D>
963 template <
class T,
class D>
971 template <
class T,
class D>
982 template <
class CharT,
class Traits,
class Y,
class D>
983 std::basic_ostream<CharT, Traits> &
984 operator<<(
std::basic_ostream<CharT, Traits> &os,
const unique_ptr<Y, D> &ptr) {
1018 template <
typename Type,
typename Deleter>
1021 return std::hash<
typename throwing::unique_ptr<
1022 Type, Deleter>::std_unique_ptr_type>()(x.get_std_unique_ptr());
1028 #include <throwing/private/clear_compiler_checks.hpp> unique_ptr(U ptr, typename std::remove_reference< Deleter >::type &&d2) TSP_NOEXCEPT
Constructs a throwing::unique_ptr object which owns ptr.
bool operator!=(const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
std::unique_ptr< T, Deleter > std_unique_ptr_type
type of the wrapped std::unique_ptr.
TSP_CONSTEXPR unique_ptr(std::nullptr_t) TSP_NOEXCEPT
Constructs a unique_ptr that owns nothing.
~unique_ptr()=default
Destructor If get() == nullptr there are no effects. Otherwise, the owned object is destroyed via get...
~unique_ptr()=default
Destructor If get() == nullptr there are no effects. Otherwise, the owned object is destroyed via get...
void reset(pointer ptr=pointer()) TSP_NOEXCEPT
Replaces the managed object.
std::unique_ptr< T, Deleter >::pointer pointer
type of the pointer to the pointed object.
void reset(std::nullptr_t ptr=nullptr) TSP_NOEXCEPT
Equivalent to reset(pointer())
bool operator<=(const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
bool operator<=(const unique_ptr< T, D > &lhs, std::nullptr_t rhs)
Compare a unique_ptr with a null pointer.
unique_ptr & operator=(unique_ptr< U, E > &&r) TSP_NOEXCEPT
Assignment operator.
bool operator==(const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
bool operator>(const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
unique_ptr & operator=(std::unique_ptr< U, E > &&r) TSP_NOEXCEPT
Assignment from std::unique_ptr operator.
bool operator>=(const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
void swap(unique_ptr &other) TSP_NOEXCEPT
Swaps the managed objects and associated deleters of *this and another unique_ptr object other...
operator bool() const TSP_NOEXCEPT
Checks whether *this owns an object, i.e. whether get() != nullptr.
unique_ptr that manages a single object
pointer get() const TSP_NOEXCEPT
Returns a pointer to the managed object or nullptr if no object is owned.
true for throwing::unique_ptr to single object
TSP_CONSTEXPR unique_ptr() TSP_NOEXCEPT=default
Constructs a throwing::unique_ptr that owns nothing.
std_unique_ptr_type & get_std_unique_ptr() TSP_NOEXCEPT
Returns reference to the wrapped std::unique_ptr.
pointer get() const TSP_NOEXCEPT
Returns a pointer to the managed object or nullptr if no object is owned.
const Deleter & get_deleter() const TSP_NOEXCEPT
Returns the deleter object which would be used for destruction of the managed object.
pointer release() TSP_NOEXCEPT
Releases the ownership of the managed object if any.
bool operator<(std::nullptr_t lhs, const unique_ptr< T, D > &rhs)
Compare a unique_ptr with a null pointer.
bool operator>(const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
pointer release() TSP_NOEXCEPT
Releases the ownership of the managed object if any.
bool operator<(const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
Deleter & get_deleter() TSP_NOEXCEPT
Returns the deleter object which would be used for destruction of the managed object.
void swap(throwing::unique_ptr< T > &lhs, throwing::unique_ptr< T > &rhs) TSP_NOEXCEPT
Specializes the std::swap algorithm for throwing::unique_ptr.
std::unique_ptr< T, Deleter >::deleter_type deleter_type
type of the deleter.
std::add_lvalue_reference< T >::type operator*() const
Dereferences the stored pointer.
detail::_Unique_if< T >::_Known_bound make_unique(Args &&...)=delete
Construction of arrays of known bound is disallowed.
bool operator<(const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
unique_ptr(std::unique_ptr< U, E > &&u) TSP_NOEXCEPT
Constructs a unique_ptr by transferring ownership from u to *this, where u is constructed with a spec...
bool operator==(const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
bool operator<=(std::nullptr_t lhs, const unique_ptr< T, D > &rhs)
Compare a unique_ptr with a null pointer.
bool operator!=(const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
unique_ptr(unique_ptr &&u) TSP_NOEXCEPT
Constructs a unique_ptr by transferring ownership from u to *this.
unique_ptr & operator=(unique_ptr< U, E > &&r) TSP_NOEXCEPT
Assignment operator.
unique_ptr(pointer ptr) TSP_NOEXCEPT
Constructs a unique_ptr which owns p.
Implementations of throwing::shared_ptr, throwing::unique_ptr and related.
const Deleter & get_deleter() const TSP_NOEXCEPT
Returns the deleter object which would be used for destruction of the managed object.
unique_ptr & operator=(unique_ptr &&r) TSP_NOEXCEPT
Assignment operator.
unique_ptr & operator=(std::unique_ptr< U, E > &&r) TSP_NOEXCEPT
Assignment from std::unique_ptr operator.
unique_ptr(unique_ptr< U, E > &&u) TSP_NOEXCEPT
Constructs a unique_ptr by transferring ownership from u to *this, where u is constructed with a spec...
bool operator==(const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
void reset(pointer ptr=pointer()) TSP_NOEXCEPT
Replaces the managed object.
bool operator>(const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
size_t operator()(const throwing::unique_ptr< Type, Deleter > &x) const
unique_ptr & operator=(std::nullptr_t) TSP_NOEXCEPT
Assignment operator.
TSP_CONSTEXPR unique_ptr() TSP_NOEXCEPT=default
Constructs a unique_ptr that owns nothing.
unique_ptr(unique_ptr &&u) TSP_NOEXCEPT
Constructs a unique_ptr by transferring ownership from u to *this.
operator bool() const TSP_NOEXCEPT
Checks whether *this owns an object, i.e. whether get() != nullptr.
std::unique_ptr< T[], Deleter > std_unique_ptr_type
type of the wrapped std::unique_ptr.
unique_ptr(U ptr, typename std::conditional< std::is_reference< Deleter >::value, Deleter, const Deleter &>::type d1) TSP_NOEXCEPT
Constructs a throwing::unique_ptr object which owns ptr.
throwing::unique_ptr< T > _Single_object
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.
bool operator!=(std::nullptr_t lhs, const unique_ptr< T, D > &rhs) TSP_NOEXCEPT
Compare a unique_ptr with a null pointer.
std::unique_ptr< T, Deleter >::element_type element_type
type of the pointed object.
const std_unique_ptr_type & get_std_unique_ptr() const TSP_NOEXCEPT
Returns const reference to the wrapped std::unique_ptr.
bool operator>(std::nullptr_t lhs, const unique_ptr< T, D > &rhs)
Compare a unique_ptr with a null pointer.
bool operator==(const unique_ptr< T, D > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a unique_ptr with a null pointer.
const std_unique_ptr_type & get_std_unique_ptr() const TSP_NOEXCEPT
Returns const reference to the wrapped std::unique_ptr.
unique_ptr(std::unique_ptr< U, E > &&u) TSP_NOEXCEPT
Constructs a unique_ptr by transferring ownership from a std::unique_ptr u to *this, where u is constructed with a specified deleter (E).
unique_ptr(U ptr) TSP_NOEXCEPT
Constructs a throwing::unique_ptr which owns p.
unique_ptr(pointer ptr, typename std::remove_reference< Deleter >::type &&d2) TSP_NOEXCEPT
Constructs a std::unique_ptr object which owns p.
bool operator!=(const unique_ptr< T, D > &lhs, std::nullptr_t rhs) TSP_NOEXCEPT
Compare a unique_ptr with a null pointer.
std::unique_ptr< T[], Deleter >::pointer pointer
type of the pointer to the pointed objects.
void swap(unique_ptr &other) TSP_NOEXCEPT
Swaps the managed objects and associated deleters of *this and another unique_ptr object other...
pointer operator->() const
Dereferences the stored pointer.
bool operator>=(const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
bool operator<=(const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
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 par...
void reset(U ptr) TSP_NOEXCEPT
Replaces the managed object.
bool operator==(std::nullptr_t lhs, const unique_ptr< T, D > &rhs) TSP_NOEXCEPT
Compare a unique_ptr with a null pointer.
std_unique_ptr_type & get_std_unique_ptr() TSP_NOEXCEPT
Returns reference to the wrapped std::unique_ptr.
unique_ptr & operator=(unique_ptr &&r) TSP_NOEXCEPT
Assignment operator.
bool operator>=(const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
Deleter & get_deleter() TSP_NOEXCEPT
Returns the deleter object which would be used for destruction of the managed object.
TSP_CONSTEXPR unique_ptr(std::nullptr_t) TSP_NOEXCEPT
Constructs a throwing::unique_ptr that owns nothing.
bool operator>=(std::nullptr_t lhs, const unique_ptr< T, D > &rhs)
Compare a unique_ptr with a null pointer.
bool operator<(const std::unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
unique_ptr(pointer ptr, typename std::conditional< std::is_reference< Deleter >::value, Deleter, const Deleter &>::type d1) TSP_NOEXCEPT
Constructs a std::unique_ptr object which owns p.
unique_ptr & operator=(std::nullptr_t) TSP_NOEXCEPT
Assignment operator.
T & operator[](size_t i) const
provides access to elements of an array managed by a unique_ptr.
bool operator>(const unique_ptr< T, D > &lhs, std::nullptr_t rhs)
Compare a unique_ptr with a null pointer.
bool operator<=(const unique_ptr< T1, D1 > &lhs, const std::unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
throwing::unique_ptr< T[]> _Unknown_bound
bool operator<(const unique_ptr< T, D > &lhs, std::nullptr_t rhs)
Compare a unique_ptr with a null pointer.
bool operator>=(const unique_ptr< T, D > &lhs, std::nullptr_t rhs)
Compare a unique_ptr with a null pointer.
bool operator!=(const unique_ptr< T1, D1 > &lhs, const unique_ptr< T2, D2 > &rhs)
Compare two unique_ptr objects.
unique_ptr(unique_ptr< U, E > &&u) TSP_NOEXCEPT
Constructs a unique_ptr by transferring ownership from u to *this, where u is constructed with a spec...
std::unique_ptr< T[], Deleter >::element_type element_type
type of the pointed objects.
std::unique_ptr< T[], Deleter >::deleter_type deleter_type
type of the deleter.