31 #define _UNIQUE_PTR_H 1
39 #if __cplusplus >= 202002L
46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 #if _GLIBCXX_USE_DEPRECATED
56 #pragma GCC diagnostic push
57 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
58 template<
typename>
class auto_ptr;
59 #pragma GCC diagnostic pop
67 template<
typename _Tp>
78 template<typename _Up,
89 "can't delete pointer to incomplete type");
90 static_assert(
sizeof(_Tp)>0,
91 "can't delete pointer to incomplete type");
104 template<
typename _Tp>
120 template<typename _Up,
126 template<
typename _Up>
131 static_assert(
sizeof(_Tp)>0,
132 "can't delete pointer to incomplete type");
140 template <
typename _Tp,
typename _Dp>
141 class __uniq_ptr_impl
143 template <
typename _Up,
typename _Ep,
typename =
void>
149 template <
typename _Up,
typename _Ep>
151 _Ptr<_Up, _Ep, __void_t<typename remove_reference<_Ep>::type::pointer>>
153 using type =
typename remove_reference<_Ep>::type::pointer;
157 using _DeleterConstraint = enable_if<
158 __and_<__not_<is_pointer<_Dp>>,
159 is_default_constructible<_Dp>>::value>;
161 using pointer =
typename _Ptr<_Tp, _Dp>::type;
163 static_assert( !is_rvalue_reference<_Dp>::value,
164 "unique_ptr's deleter type must be a function object type"
165 " or an lvalue reference type" );
167 __uniq_ptr_impl() =
default;
169 __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; }
171 template<
typename _Del>
173 __uniq_ptr_impl(pointer __p, _Del&& __d)
177 __uniq_ptr_impl(__uniq_ptr_impl&& __u) noexcept
179 { __u._M_ptr() =
nullptr; }
182 __uniq_ptr_impl& operator=(__uniq_ptr_impl&& __u) noexcept
184 reset(__u.release());
185 _M_deleter() = std::forward<_Dp>(__u._M_deleter());
190 pointer& _M_ptr() noexcept {
return std::get<0>(_M_t); }
192 pointer _M_ptr() const noexcept {
return std::get<0>(_M_t); }
194 _Dp& _M_deleter() noexcept {
return std::get<1>(_M_t); }
196 const _Dp& _M_deleter() const noexcept {
return std::get<1>(_M_t); }
199 void reset(pointer __p) noexcept
201 const pointer __old_p = _M_ptr();
204 _M_deleter()(__old_p);
208 pointer release() noexcept
210 pointer __p = _M_ptr();
217 swap(__uniq_ptr_impl& __rhs) noexcept
220 swap(this->_M_ptr(), __rhs._M_ptr());
221 swap(this->_M_deleter(), __rhs._M_deleter());
225 tuple<pointer, _Dp> _M_t;
229 template <
typename _Tp,
typename _Dp,
230 bool = is_move_constructible<_Dp>::value,
231 bool = is_move_assignable<_Dp>::value>
232 struct __uniq_ptr_data : __uniq_ptr_impl<_Tp, _Dp>
234 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
235 __uniq_ptr_data(__uniq_ptr_data&&) =
default;
236 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
default;
239 template <
typename _Tp,
typename _Dp>
240 struct __uniq_ptr_data<_Tp, _Dp, true, false> : __uniq_ptr_impl<_Tp, _Dp>
242 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
243 __uniq_ptr_data(__uniq_ptr_data&&) =
default;
244 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
247 template <
typename _Tp,
typename _Dp>
248 struct __uniq_ptr_data<_Tp, _Dp, false, true> : __uniq_ptr_impl<_Tp, _Dp>
250 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
251 __uniq_ptr_data(__uniq_ptr_data&&) =
delete;
252 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
default;
255 template <
typename _Tp,
typename _Dp>
256 struct __uniq_ptr_data<_Tp, _Dp, false, false> : __uniq_ptr_impl<_Tp, _Dp>
258 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
259 __uniq_ptr_data(__uniq_ptr_data&&) =
delete;
260 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
269 template <
typename _Tp,
typename _Dp = default_delete<_Tp>>
272 template <
typename _Up>
273 using _DeleterConstraint =
274 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
276 __uniq_ptr_data<_Tp, _Dp> _M_t;
279 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
280 using element_type = _Tp;
281 using deleter_type = _Dp;
286 template<
typename _Up,
typename _Ep>
287 using __safe_conversion_up = __and_<
289 __not_<is_array<_Up>>
296 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
307 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
321 template<
typename _Del = deleter_type,
322 typename = _Require<is_copy_constructible<_Del>>>
334 template<
typename _Del = deleter_type,
335 typename = _Require<is_move_constructible<_Del>>>
339 _Del&&> __d) noexcept
343 template<
typename _Del = deleter_type,
344 typename _DelUnref =
typename remove_reference<_Del>::type>
348 _DelUnref&&>) =
delete;
351 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
367 template<
typename _Up,
typename _Ep,
typename = _Require<
368 __safe_conversion_up<_Up, _Ep>,
369 __conditional_t<is_reference<_Dp>::value,
374 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
377 #if _GLIBCXX_USE_DEPRECATED
378 #pragma GCC diagnostic push
379 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
381 template<
typename _Up,
382 typename = _Require<is_convertible<_Up*, pointer>,
385 #pragma GCC diagnostic pop
389 #if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
394 static_assert(__is_invocable<deleter_type&, pointer>::value,
395 "unique_ptr's deleter must be invocable with a pointer");
396 auto& __ptr = _M_t._M_ptr();
397 if (__ptr !=
nullptr)
417 template<
typename _Up,
typename _Ep>
420 __safe_conversion_up<_Up, _Ep>,
426 reset(__u.release());
427 get_deleter() = std::forward<_Ep>(__u.get_deleter());
444 typename add_lvalue_reference<element_type>::type
447 #if _GLIBCXX_USE_BUILTIN_TRAIT(__reference_converts_from_temporary)
450 using _ResT =
typename add_lvalue_reference<element_type>::type;
451 using _DerefT = decltype(*
get());
452 static_assert(!__reference_converts_from_temporary(_ResT, _DerefT),
453 "operator* must not return a dangling reference");
455 __glibcxx_assert(
get() != pointer());
464 _GLIBCXX_DEBUG_PEDASSERT(
get() != pointer());
472 {
return _M_t._M_ptr(); }
478 {
return _M_t._M_deleter(); }
484 {
return _M_t._M_deleter(); }
488 explicit operator bool() const noexcept
489 {
return get() == pointer() ? false :
true; }
497 {
return _M_t.release(); }
507 reset(pointer __p = pointer()) noexcept
509 static_assert(__is_invocable<deleter_type&, pointer>::value,
510 "unique_ptr's deleter must be invocable with a pointer");
519 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
528 #ifdef __glibcxx_out_ptr
529 template<
typename,
typename,
typename...>
530 friend class out_ptr_t;
531 template<
typename,
typename,
typename...>
532 friend class inout_ptr_t;
544 template<
typename _Tp,
typename _Dp>
547 template <
typename _Up>
548 using _DeleterConstraint =
549 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
551 __uniq_ptr_data<_Tp, _Dp> _M_t;
554 template<
typename _Up>
555 using __is_derived_Tp
556 = __and_< is_base_of<_Tp, _Up>,
557 __not_<is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up>>> >;
560 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
561 using element_type = _Tp;
562 using deleter_type = _Dp;
566 template<
typename _Up,
typename _Ep,
568 typename _UP_pointer =
typename _UPtr::pointer,
569 typename _UP_element_type =
typename _UPtr::element_type>
570 using __safe_conversion_up = __and_<
578 template<
typename _Up>
579 using __safe_conversion_raw = __and_<
580 __or_<__or_<is_same<_Up, pointer>,
582 __and_<is_pointer<_Up>,
585 typename remove_pointer<_Up>::type(*)[],
594 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
606 template<
typename _Up,
608 typename = _DeleterConstraint<_Vp>,
610 __safe_conversion_raw<_Up>::value,
bool>::type>
625 template<
typename _Up,
typename _Del = deleter_type,
626 typename = _Require<__safe_conversion_raw<_Up>,
640 template<
typename _Up,
typename _Del = deleter_type,
641 typename = _Require<__safe_conversion_raw<_Up>,
646 _Del&&> __d) noexcept
650 template<
typename _Up,
typename _Del = deleter_type,
651 typename _DelUnref =
typename remove_reference<_Del>::type,
652 typename = _Require<__safe_conversion_raw<_Up>>>
655 _DelUnref&&>) =
delete;
661 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
666 template<
typename _Up,
typename _Ep,
typename = _Require<
667 __safe_conversion_up<_Up, _Ep>,
668 __conditional_t<is_reference<_Dp>::value,
673 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
677 #if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
682 auto& __ptr = _M_t._M_ptr();
683 if (__ptr !=
nullptr)
684 get_deleter()(__ptr);
704 template<
typename _Up,
typename _Ep>
713 reset(__u.release());
714 get_deleter() = std::forward<_Ep>(__u.get_deleter());
731 typename std::add_lvalue_reference<element_type>::type
734 __glibcxx_assert(get() != pointer());
742 {
return _M_t._M_ptr(); }
748 {
return _M_t._M_deleter(); }
754 {
return _M_t._M_deleter(); }
758 explicit operator bool() const noexcept
759 {
return get() == pointer() ? false :
true; }
767 {
return _M_t.release(); }
775 template <
typename _Up,
777 __or_<is_same<_Up, pointer>,
778 __and_<is_same<pointer, element_type*>,
781 typename remove_pointer<_Up>::type(*)[],
793 void reset(nullptr_t =
nullptr) noexcept
794 { reset(pointer()); }
801 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
810 #ifdef __glibcxx_out_ptr
811 template<
typename,
typename,
typename...>
friend class out_ptr_t;
812 template<
typename,
typename,
typename...>
friend class inout_ptr_t;
820 template<
typename _Tp,
typename _Dp>
822 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
825 typename enable_if<__is_swappable<_Dp>::value>::type
833 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
834 template<
typename _Tp,
typename _Dp>
841 template<
typename _Tp,
typename _Dp,
842 typename _Up,
typename _Ep>
843 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
847 {
return __x.
get() == __y.
get(); }
850 template<
typename _Tp,
typename _Dp>
851 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
856 #ifndef __cpp_lib_three_way_comparison
858 template<
typename _Tp,
typename _Dp>
861 operator==(nullptr_t,
const unique_ptr<_Tp, _Dp>& __x) noexcept
865 template<
typename _Tp,
typename _Dp,
866 typename _Up,
typename _Ep>
869 operator!=(
const unique_ptr<_Tp, _Dp>& __x,
870 const unique_ptr<_Up, _Ep>& __y)
871 {
return __x.get() != __y.get(); }
874 template<
typename _Tp,
typename _Dp>
877 operator!=(
const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept
878 {
return (
bool)__x; }
881 template<
typename _Tp,
typename _Dp>
884 operator!=(nullptr_t,
const unique_ptr<_Tp, _Dp>& __x) noexcept
885 {
return (
bool)__x; }
889 template<
typename _Tp,
typename _Dp,
890 typename _Up,
typename _Ep>
891 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
898 typename unique_ptr<_Up, _Ep>::pointer>::type _CT;
903 template<
typename _Tp,
typename _Dp>
904 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
913 template<
typename _Tp,
typename _Dp>
914 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
923 template<
typename _Tp,
typename _Dp,
924 typename _Up,
typename _Ep>
925 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
929 {
return !(__y < __x); }
932 template<
typename _Tp,
typename _Dp>
933 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
936 {
return !(
nullptr < __x); }
939 template<
typename _Tp,
typename _Dp>
940 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
943 {
return !(__x <
nullptr); }
946 template<
typename _Tp,
typename _Dp,
947 typename _Up,
typename _Ep>
948 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
952 {
return (__y < __x); }
955 template<
typename _Tp,
typename _Dp>
956 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
965 template<
typename _Tp,
typename _Dp>
966 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
975 template<
typename _Tp,
typename _Dp,
976 typename _Up,
typename _Ep>
977 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
981 {
return !(__x < __y); }
984 template<
typename _Tp,
typename _Dp>
985 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
988 {
return !(__x <
nullptr); }
991 template<
typename _Tp,
typename _Dp>
992 _GLIBCXX_NODISCARD
inline bool
994 {
return !(
nullptr < __x); }
996 #ifdef __cpp_lib_three_way_comparison
997 template<
typename _Tp,
typename _Dp,
typename _Up,
typename _Ep>
998 requires three_way_comparable_with<typename unique_ptr<_Tp, _Dp>::pointer,
999 typename unique_ptr<_Up, _Ep>::pointer>
1000 _GLIBCXX23_CONSTEXPR
1002 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer,
1003 typename unique_ptr<_Up, _Ep>::pointer>
1004 operator<=>(
const unique_ptr<_Tp, _Dp>& __x,
1005 const unique_ptr<_Up, _Ep>& __y)
1006 {
return compare_three_way()(__x.get(), __y.get()); }
1008 template<
typename _Tp,
typename _Dp>
1009 requires three_way_comparable<typename unique_ptr<_Tp, _Dp>::pointer>
1010 _GLIBCXX23_CONSTEXPR
1012 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer>
1013 operator<=>(
const unique_ptr<_Tp, _Dp>& __x, nullptr_t)
1015 using pointer =
typename unique_ptr<_Tp, _Dp>::pointer;
1016 return compare_three_way()(__x.get(),
static_cast<pointer
>(
nullptr));
1022 template<
typename _Up,
typename _Ptr =
typename _Up::po
inter>
1023 struct __uniq_ptr_hash
1024 :
public __hash_base<size_t, _Up>
1025 #if ! _GLIBCXX_INLINE_VERSION
1026 ,
private __hash_empty_base<_Ptr>
1030 operator()(
const _Up& __u)
const
1031 noexcept(noexcept(
std::declval<hash<_Ptr>>()(std::declval<_Ptr>())))
1032 {
return hash<_Ptr>()(__u.get()); }
1035 template<
typename _Up>
1036 using __uniq_ptr_hash_base
1037 = __conditional_t<__is_hash_enabled_for<typename _Up::pointer>,
1038 __uniq_ptr_hash<_Up>,
1039 __hash_not_enabled<typename _Up::pointer>>;
1043 template<
typename _Tp,
typename _Dp>
1045 :
public __uniq_ptr_hash_base<unique_ptr<_Tp, _Dp>>
1048 #ifdef __glibcxx_make_unique
1052 template<
typename _Tp>
1056 template<
typename _Tp>
1057 struct _MakeUniq<_Tp[]>
1058 {
typedef unique_ptr<_Tp[]> __array; };
1060 template<
typename _Tp,
size_t _Bound>
1061 struct _MakeUniq<_Tp[_Bound]>
1062 {
struct __invalid_type { }; };
1064 template<
typename _Tp>
1065 using __unique_ptr_t =
typename _MakeUniq<_Tp>::__single_object;
1066 template<
typename _Tp>
1067 using __unique_ptr_array_t =
typename _MakeUniq<_Tp>::__array;
1068 template<
typename _Tp>
1069 using __invalid_make_unique_t =
typename _MakeUniq<_Tp>::__invalid_type;
1080 template<
typename _Tp,
typename... _Args>
1081 _GLIBCXX23_CONSTEXPR
1082 inline __detail::__unique_ptr_t<_Tp>
1095 template<
typename _Tp>
1096 _GLIBCXX23_CONSTEXPR
1097 inline __detail::__unique_ptr_array_t<_Tp>
1106 template<
typename _Tp,
typename... _Args>
1107 __detail::__invalid_make_unique_t<_Tp>
1110 #if __cplusplus > 201703L
1117 template<
typename _Tp>
1118 _GLIBCXX23_CONSTEXPR
1119 inline __detail::__unique_ptr_t<_Tp>
1130 template<
typename _Tp>
1131 _GLIBCXX23_CONSTEXPR
1132 inline __detail::__unique_ptr_array_t<_Tp>
1141 template<
typename _Tp,
typename... _Args>
1142 __detail::__invalid_make_unique_t<_Tp>
1148 #if __cplusplus > 201703L && __cpp_concepts && _GLIBCXX_HOSTED
1154 template<
typename _CharT,
typename _Traits,
typename _Tp,
typename _Dp>
1158 requires requires { __os << __p.get(); }
1165 #if __cpp_variable_templates
1166 template<
typename _Tp>
1167 constexpr
bool __is_unique_ptr =
false;
1168 template<
typename _Tp,
typename _Del>
1169 constexpr
bool __is_unique_ptr<unique_ptr<_Tp, _Del>> =
true;
1174 #if __cplusplus >= 201703L
1175 namespace __detail::__variant
1177 template<
typename>
struct _Never_valueless_alt;
1181 template<
typename _Tp,
typename _Del>
1182 struct _Never_valueless_alt<
std::unique_ptr<_Tp, _Del>>
1188 _GLIBCXX_END_NAMESPACE_VERSION
__detail::__invalid_make_unique_t< _Tp > make_unique_for_overwrite(_Args &&...)=delete
constexpr __detail::__unique_ptr_array_t< _Tp > make_unique_for_overwrite(size_t __num)
constexpr __detail::__unique_ptr_array_t< _Tp > make_unique(size_t __num)
constexpr enable_if< __is_swappable< _Dp >::value >::type swap(unique_ptr< _Tp, _Dp > &__x, unique_ptr< _Tp, _Dp > &__y) noexcept
__detail::__invalid_make_unique_t< _Tp > make_unique(_Args &&...)=delete
constexpr __detail::__unique_ptr_t< _Tp > make_unique_for_overwrite()
constexpr __detail::__unique_ptr_t< _Tp > make_unique(_Args &&... __args)
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
typename remove_extent< _Tp >::type remove_extent_t
Alias template for remove_extent.
auto declval() noexcept -> decltype(__declval< _Tp >(0))
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
Template class basic_ostream.
Primary class template hash.
Define a member typedef type only if a boolean constant is true.
A simple smart pointer providing strict ownership semantics.
One of the comparison functors.
constexpr void operator()(_Tp *__ptr) const
Calls delete __ptr
constexpr default_delete() noexcept=default
Default constructor.
constexpr default_delete() noexcept=default
Default constructor.
constexpr enable_if< is_convertible< _Up(*)[], _Tp(*)[]>::value >::type operator()(_Up *__ptr) const
Calls delete[] __ptr
A move-only smart pointer that manages unique ownership of a resource.
constexpr pointer operator->() const noexcept
Return the stored pointer.
constexpr deleter_type & get_deleter() noexcept
Return a reference to the stored deleter.
constexpr unique_ptr(pointer __p) noexcept
constexpr unique_ptr() noexcept
Default constructor, creates a unique_ptr that owns nothing.
constexpr unique_ptr(pointer __p, const deleter_type &__d) noexcept
unique_ptr(unique_ptr &&)=default
Move constructor.
constexpr add_lvalue_reference< element_type >::type operator*() const noexcept(noexcept(*std::declval< pointer >()))
Dereference the stored pointer.
constexpr void reset(pointer __p=pointer()) noexcept
Replace the stored pointer.
unique_ptr & operator=(unique_ptr &&)=default
Move assignment operator.
~unique_ptr() noexcept
Destructor, invokes the deleter if the stored pointer is not null.
constexpr const deleter_type & get_deleter() const noexcept
Return a reference to the stored deleter.
constexpr unique_ptr(unique_ptr< _Up, _Ep > &&__u) noexcept
Converting constructor from another type.
constexpr void swap(unique_ptr &__u) noexcept
Exchange the pointer and deleter with another object.
constexpr pointer get() const noexcept
Return the stored pointer.
constexpr unique_ptr & operator=(nullptr_t) noexcept
Reset the unique_ptr to empty, invoking the deleter if necessary.
constexpr enable_if< __and_< __safe_conversion_up< _Up, _Ep >, is_assignable< deleter_type &, _Ep && > >::value, unique_ptr & >::type operator=(unique_ptr< _Up, _Ep > &&__u) noexcept
Assignment from another type.
constexpr unique_ptr(pointer __p, __enable_if_t<!is_lvalue_reference< _Del >::value, _Del && > __d) noexcept
constexpr pointer release() noexcept
Release ownership of any stored pointer.
constexpr unique_ptr(nullptr_t) noexcept
Creates a unique_ptr that owns nothing.
A move-only smart pointer that manages unique ownership of an array.
constexpr pointer release() noexcept
Release ownership of any stored pointer.
constexpr unique_ptr & operator=(nullptr_t) noexcept
Reset the unique_ptr to empty, invoking the deleter if necessary.
constexpr std::add_lvalue_reference< element_type >::type operator[](size_t __i) const
Access an element of owned array.
constexpr unique_ptr(nullptr_t) noexcept
Creates a unique_ptr that owns nothing.
constexpr void swap(unique_ptr &__u) noexcept
Exchange the pointer and deleter with another object.
unique_ptr & operator=(unique_ptr &&)=default
Move assignment operator.
constexpr unique_ptr() noexcept
Default constructor, creates a unique_ptr that owns nothing.
constexpr void reset(_Up __p) noexcept
Replace the stored pointer.
constexpr pointer get() const noexcept
Return the stored pointer.
constexpr enable_if< __and_< __safe_conversion_up< _Up, _Ep >, is_assignable< deleter_type &, _Ep && > >::value, unique_ptr & >::type operator=(unique_ptr< _Up, _Ep > &&__u) noexcept
Assignment from another type.
constexpr unique_ptr(_Up __p, __enable_if_t<!is_lvalue_reference< _Del >::value, _Del && > __d) noexcept
constexpr unique_ptr(_Up __p) noexcept
unique_ptr(unique_ptr &&)=default
Move constructor.
constexpr unique_ptr(_Up __p, const deleter_type &__d) noexcept
~unique_ptr()
Destructor, invokes the deleter if the stored pointer is not null.
constexpr const deleter_type & get_deleter() const noexcept
Return a reference to the stored deleter.
constexpr deleter_type & get_deleter() noexcept
Return a reference to the stored deleter.