31 #define _UNIQUE_PTR_H 1
39 #if __cplusplus > 201703L
44 #if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
45 # if __cpp_lib_constexpr_memory < 202202L
47 # undef __cpp_lib_constexpr_memory
48 # define __cpp_lib_constexpr_memory 202202L
52 namespace std _GLIBCXX_VISIBILITY(default)
54 _GLIBCXX_BEGIN_NAMESPACE_VERSION
61 #if _GLIBCXX_USE_DEPRECATED
62 #pragma GCC diagnostic push
63 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
64 template<
typename>
class auto_ptr;
65 #pragma GCC diagnostic pop
70 template<
typename _Tp>
81 template<typename _Up,
92 "can't delete pointer to incomplete type");
93 static_assert(
sizeof(_Tp)>0,
94 "can't delete pointer to incomplete type");
103 template<
typename _Tp>
119 template<typename _Up,
125 template<
typename _Up>
130 static_assert(
sizeof(_Tp)>0,
131 "can't delete pointer to incomplete type");
139 template <
typename _Tp,
typename _Dp>
140 class __uniq_ptr_impl
142 template <
typename _Up,
typename _Ep,
typename =
void>
148 template <
typename _Up,
typename _Ep>
150 _Ptr<_Up, _Ep, __void_t<typename remove_reference<_Ep>::type::pointer>>
152 using type =
typename remove_reference<_Ep>::type::pointer;
156 using _DeleterConstraint = enable_if<
157 __and_<__not_<is_pointer<_Dp>>,
158 is_default_constructible<_Dp>>::value>;
160 using pointer =
typename _Ptr<_Tp, _Dp>::type;
162 static_assert( !is_rvalue_reference<_Dp>::value,
163 "unique_ptr's deleter type must be a function object type"
164 " or an lvalue reference type" );
166 __uniq_ptr_impl() =
default;
168 __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; }
170 template<
typename _Del>
172 __uniq_ptr_impl(pointer __p, _Del&& __d)
176 __uniq_ptr_impl(__uniq_ptr_impl&& __u) noexcept
178 { __u._M_ptr() =
nullptr; }
181 __uniq_ptr_impl& operator=(__uniq_ptr_impl&& __u) noexcept
183 reset(__u.release());
184 _M_deleter() = std::forward<_Dp>(__u._M_deleter());
189 pointer& _M_ptr() noexcept {
return std::get<0>(_M_t); }
191 pointer _M_ptr() const noexcept {
return std::get<0>(_M_t); }
193 _Dp& _M_deleter() noexcept {
return std::get<1>(_M_t); }
195 const _Dp& _M_deleter() const noexcept {
return std::get<1>(_M_t); }
198 void reset(pointer __p) noexcept
200 const pointer __old_p = _M_ptr();
203 _M_deleter()(__old_p);
207 pointer release() noexcept
209 pointer __p = _M_ptr();
216 swap(__uniq_ptr_impl& __rhs) noexcept
219 swap(this->_M_ptr(), __rhs._M_ptr());
220 swap(this->_M_deleter(), __rhs._M_deleter());
224 tuple<pointer, _Dp> _M_t;
228 template <
typename _Tp,
typename _Dp,
229 bool = is_move_constructible<_Dp>::value,
230 bool = is_move_assignable<_Dp>::value>
231 struct __uniq_ptr_data : __uniq_ptr_impl<_Tp, _Dp>
233 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
234 __uniq_ptr_data(__uniq_ptr_data&&) =
default;
235 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
default;
238 template <
typename _Tp,
typename _Dp>
239 struct __uniq_ptr_data<_Tp, _Dp, true, false> : __uniq_ptr_impl<_Tp, _Dp>
241 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
242 __uniq_ptr_data(__uniq_ptr_data&&) =
default;
243 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
246 template <
typename _Tp,
typename _Dp>
247 struct __uniq_ptr_data<_Tp, _Dp, false, true> : __uniq_ptr_impl<_Tp, _Dp>
249 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
250 __uniq_ptr_data(__uniq_ptr_data&&) =
delete;
251 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
default;
254 template <
typename _Tp,
typename _Dp>
255 struct __uniq_ptr_data<_Tp, _Dp, false, false> : __uniq_ptr_impl<_Tp, _Dp>
257 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
258 __uniq_ptr_data(__uniq_ptr_data&&) =
delete;
259 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
268 template <
typename _Tp,
typename _Dp = default_delete<_Tp>>
271 template <
typename _Up>
272 using _DeleterConstraint =
273 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
275 __uniq_ptr_data<_Tp, _Dp> _M_t;
278 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
279 using element_type = _Tp;
280 using deleter_type = _Dp;
285 template<
typename _Up,
typename _Ep>
286 using __safe_conversion_up = __and_<
288 __not_<is_array<_Up>>
295 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
306 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
320 template<
typename _Del = deleter_type,
321 typename = _Require<is_copy_constructible<_Del>>>
333 template<
typename _Del = deleter_type,
334 typename = _Require<is_move_constructible<_Del>>>
338 _Del&&> __d) noexcept
342 template<
typename _Del = deleter_type,
343 typename _DelUnref =
typename remove_reference<_Del>::type>
347 _DelUnref&&>) =
delete;
350 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
366 template<
typename _Up,
typename _Ep,
typename = _Require<
367 __safe_conversion_up<_Up, _Ep>,
368 __conditional_t<is_reference<_Dp>::value,
373 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
376 #if _GLIBCXX_USE_DEPRECATED
377 #pragma GCC diagnostic push
378 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
380 template<
typename _Up,
typename = _Require<
383 #pragma GCC diagnostic pop
387 #if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
392 static_assert(__is_invocable<deleter_type&, pointer>::value,
393 "unique_ptr's deleter must be invocable with a pointer");
394 auto& __ptr = _M_t._M_ptr();
395 if (__ptr !=
nullptr)
415 template<
typename _Up,
typename _Ep>
418 __safe_conversion_up<_Up, _Ep>,
424 reset(__u.release());
425 get_deleter() = std::forward<_Ep>(__u.get_deleter());
442 typename add_lvalue_reference<element_type>::type
445 __glibcxx_assert(
get() != pointer());
454 _GLIBCXX_DEBUG_PEDASSERT(
get() != pointer());
462 {
return _M_t._M_ptr(); }
468 {
return _M_t._M_deleter(); }
474 {
return _M_t._M_deleter(); }
478 explicit operator bool() const noexcept
479 {
return get() == pointer() ? false :
true; }
487 {
return _M_t.release(); }
497 reset(pointer __p = pointer()) noexcept
499 static_assert(__is_invocable<deleter_type&, pointer>::value,
500 "unique_ptr's deleter must be invocable with a pointer");
509 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
526 template<
typename _Tp,
typename _Dp>
529 template <
typename _Up>
530 using _DeleterConstraint =
531 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
533 __uniq_ptr_data<_Tp, _Dp> _M_t;
535 template<
typename _Up>
536 using __remove_cv =
typename remove_cv<_Up>::type;
539 template<
typename _Up>
540 using __is_derived_Tp
541 = __and_< is_base_of<_Tp, _Up>,
542 __not_<is_same<__remove_cv<_Tp>, __remove_cv<_Up>>> >;
545 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
546 using element_type = _Tp;
547 using deleter_type = _Dp;
551 template<
typename _Up,
typename _Ep,
553 typename _UP_pointer =
typename _UPtr::pointer,
554 typename _UP_element_type =
typename _UPtr::element_type>
555 using __safe_conversion_up = __and_<
563 template<
typename _Up>
564 using __safe_conversion_raw = __and_<
565 __or_<__or_<is_same<_Up, pointer>,
567 __and_<is_pointer<_Up>,
570 typename remove_pointer<_Up>::type(*)[],
579 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
591 template<
typename _Up,
593 typename = _DeleterConstraint<_Vp>,
595 __safe_conversion_raw<_Up>::value,
bool>::type>
610 template<
typename _Up,
typename _Del = deleter_type,
611 typename = _Require<__safe_conversion_raw<_Up>,
625 template<
typename _Up,
typename _Del = deleter_type,
626 typename = _Require<__safe_conversion_raw<_Up>,
631 _Del&&> __d) noexcept
635 template<
typename _Up,
typename _Del = deleter_type,
636 typename _DelUnref =
typename remove_reference<_Del>::type,
637 typename = _Require<__safe_conversion_raw<_Up>>>
640 _DelUnref&&>) =
delete;
646 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
651 template<
typename _Up,
typename _Ep,
typename = _Require<
652 __safe_conversion_up<_Up, _Ep>,
653 __conditional_t<is_reference<_Dp>::value,
658 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
662 #if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
667 auto& __ptr = _M_t._M_ptr();
668 if (__ptr !=
nullptr)
689 template<
typename _Up,
typename _Ep>
698 reset(__u.release());
699 get_deleter() = std::forward<_Ep>(__u.get_deleter());
716 typename std::add_lvalue_reference<element_type>::type
719 __glibcxx_assert(
get() != pointer());
727 {
return _M_t._M_ptr(); }
733 {
return _M_t._M_deleter(); }
739 {
return _M_t._M_deleter(); }
743 explicit operator bool() const noexcept
744 {
return get() == pointer() ? false :
true; }
752 {
return _M_t.release(); }
760 template <
typename _Up,
762 __or_<is_same<_Up, pointer>,
763 __and_<is_same<pointer, element_type*>,
766 typename remove_pointer<_Up>::type(*)[],
778 void reset(nullptr_t =
nullptr) noexcept
779 {
reset(pointer()); }
786 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
799 template<
typename _Tp,
typename _Dp>
801 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
804 typename enable_if<__is_swappable<_Dp>::value>::type
812 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
813 template<
typename _Tp,
typename _Dp>
820 template<
typename _Tp,
typename _Dp,
821 typename _Up,
typename _Ep>
822 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
826 {
return __x.
get() == __y.
get(); }
829 template<
typename _Tp,
typename _Dp>
830 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
835 #ifndef __cpp_lib_three_way_comparison
837 template<
typename _Tp,
typename _Dp>
844 template<
typename _Tp,
typename _Dp,
845 typename _Up,
typename _Ep>
850 {
return __x.
get() != __y.
get(); }
853 template<
typename _Tp,
typename _Dp>
857 {
return (
bool)__x; }
860 template<
typename _Tp,
typename _Dp>
864 {
return (
bool)__x; }
868 template<
typename _Tp,
typename _Dp,
869 typename _Up,
typename _Ep>
870 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
877 typename unique_ptr<_Up, _Ep>::pointer>::type _CT;
882 template<
typename _Tp,
typename _Dp>
883 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
892 template<
typename _Tp,
typename _Dp>
893 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
902 template<
typename _Tp,
typename _Dp,
903 typename _Up,
typename _Ep>
904 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
908 {
return !(__y < __x); }
911 template<
typename _Tp,
typename _Dp>
912 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
915 {
return !(
nullptr < __x); }
918 template<
typename _Tp,
typename _Dp>
919 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
922 {
return !(__x <
nullptr); }
925 template<
typename _Tp,
typename _Dp,
926 typename _Up,
typename _Ep>
927 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
931 {
return (__y < __x); }
934 template<
typename _Tp,
typename _Dp>
935 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
944 template<
typename _Tp,
typename _Dp>
945 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
954 template<
typename _Tp,
typename _Dp,
955 typename _Up,
typename _Ep>
956 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
960 {
return !(__x < __y); }
963 template<
typename _Tp,
typename _Dp>
964 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
967 {
return !(__x <
nullptr); }
970 template<
typename _Tp,
typename _Dp>
971 _GLIBCXX_NODISCARD
inline bool
973 {
return !(
nullptr < __x); }
975 #ifdef __cpp_lib_three_way_comparison
976 template<
typename _Tp,
typename _Dp,
typename _Up,
typename _Ep>
977 requires three_way_comparable_with<typename unique_ptr<_Tp, _Dp>::pointer,
978 typename unique_ptr<_Up, _Ep>::pointer>
981 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer,
982 typename unique_ptr<_Up, _Ep>::pointer>
983 operator<=>(
const unique_ptr<_Tp, _Dp>& __x,
984 const unique_ptr<_Up, _Ep>& __y)
985 {
return compare_three_way()(__x.get(), __y.get()); }
987 template<
typename _Tp,
typename _Dp>
988 requires three_way_comparable<typename unique_ptr<_Tp, _Dp>::pointer>
991 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer>
992 operator<=>(
const unique_ptr<_Tp, _Dp>& __x, nullptr_t)
994 using pointer =
typename unique_ptr<_Tp, _Dp>::pointer;
995 return compare_three_way()(__x.get(),
static_cast<pointer
>(
nullptr));
1001 template<
typename _Up,
typename _Ptr =
typename _Up::pointer,
1002 bool = __poison_hash<_Ptr>::__enable_hash_call>
1003 struct __uniq_ptr_hash
1004 #if ! _GLIBCXX_INLINE_VERSION
1005 :
private __poison_hash<_Ptr>
1009 operator()(
const _Up& __u)
const
1010 noexcept(noexcept(
std::declval<hash<_Ptr>>()(std::declval<_Ptr>())))
1011 {
return hash<_Ptr>()(__u.get()); }
1014 template<
typename _Up,
typename _Ptr>
1015 struct __uniq_ptr_hash<_Up, _Ptr, false>
1016 :
private __poison_hash<_Ptr>
1021 template<
typename _Tp,
typename _Dp>
1023 :
public __hash_base<size_t, unique_ptr<_Tp, _Dp>>,
1024 public __uniq_ptr_hash<unique_ptr<_Tp, _Dp>>
1027 #if __cplusplus >= 201402L
1028 #define __cpp_lib_make_unique 201304L
1033 template<
typename _Tp>
1037 template<
typename _Tp>
1038 struct _MakeUniq<_Tp[]>
1039 {
typedef unique_ptr<_Tp[]> __array; };
1041 template<
typename _Tp,
size_t _Bound>
1042 struct _MakeUniq<_Tp[_Bound]>
1043 {
struct __invalid_type { }; };
1045 template<
typename _Tp>
1046 using __unique_ptr_t =
typename _MakeUniq<_Tp>::__single_object;
1047 template<
typename _Tp>
1048 using __unique_ptr_array_t =
typename _MakeUniq<_Tp>::__array;
1049 template<
typename _Tp>
1050 using __invalid_make_unique_t =
typename _MakeUniq<_Tp>::__invalid_type;
1061 template<
typename _Tp,
typename... _Args>
1062 _GLIBCXX23_CONSTEXPR
1063 inline __detail::__unique_ptr_t<_Tp>
1076 template<
typename _Tp>
1077 _GLIBCXX23_CONSTEXPR
1078 inline __detail::__unique_ptr_array_t<_Tp>
1087 template<
typename _Tp,
typename... _Args>
1088 __detail::__invalid_make_unique_t<_Tp>
1091 #if __cplusplus > 201703L
1098 template<
typename _Tp>
1099 _GLIBCXX23_CONSTEXPR
1100 inline __detail::__unique_ptr_t<_Tp>
1111 template<
typename _Tp>
1112 _GLIBCXX23_CONSTEXPR
1113 inline __detail::__unique_ptr_array_t<_Tp>
1122 template<
typename _Tp,
typename... _Args>
1123 __detail::__invalid_make_unique_t<_Tp>
1129 #if __cplusplus > 201703L && __cpp_concepts
1135 template<
typename _CharT,
typename _Traits,
typename _Tp,
typename _Dp>
1139 requires requires { __os << __p.get(); }
1148 #if __cplusplus >= 201703L
1149 namespace __detail::__variant
1151 template<
typename>
struct _Never_valueless_alt;
1155 template<
typename _Tp,
typename _Del>
1156 struct _Never_valueless_alt<
std::unique_ptr<_Tp, _Del>>
1162 _GLIBCXX_END_NAMESPACE_VERSION
__detail::__invalid_make_unique_t< _Tp > make_unique_for_overwrite(_Args &&...)=delete
_GLIBCXX23_CONSTEXPR __detail::__unique_ptr_t< _Tp > make_unique(_Args &&... __args)
_GLIBCXX23_CONSTEXPR __detail::__unique_ptr_array_t< _Tp > make_unique_for_overwrite(size_t __num)
__detail::__invalid_make_unique_t< _Tp > make_unique(_Args &&...)=delete
_GLIBCXX23_CONSTEXPR enable_if< __is_swappable< _Dp >::value >::type swap(unique_ptr< _Tp, _Dp > &__x, unique_ptr< _Tp, _Dp > &__y) noexcept
_GLIBCXX23_CONSTEXPR __detail::__unique_ptr_array_t< _Tp > make_unique(size_t __num)
_GLIBCXX23_CONSTEXPR __detail::__unique_ptr_t< _Tp > make_unique_for_overwrite()
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.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
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.
Primary template of default_delete, used by unique_ptr for single objects.
constexpr default_delete() noexcept=default
Default constructor.
_GLIBCXX23_CONSTEXPR void operator()(_Tp *__ptr) const
Calls delete __ptr
_GLIBCXX23_CONSTEXPR enable_if< is_convertible< _Up(*)[], _Tp(*)[]>::value >::type operator()(_Up *__ptr) const
Calls delete[] __ptr
constexpr default_delete() noexcept=default
Default constructor.
A move-only smart pointer that manages unique ownership of a resource.
_GLIBCXX23_CONSTEXPR unique_ptr(pointer __p, __enable_if_t<!is_lvalue_reference< _Del >::value, _Del && > __d) noexcept
_GLIBCXX23_CONSTEXPR pointer get() const noexcept
Return the stored pointer.
_GLIBCXX23_CONSTEXPR unique_ptr(unique_ptr< _Up, _Ep > &&__u) noexcept
Converting constructor from another type.
constexpr unique_ptr() noexcept
Default constructor, creates a unique_ptr that owns nothing.
unique_ptr(unique_ptr &&)=default
Move constructor.
_GLIBCXX23_CONSTEXPR void swap(unique_ptr &__u) noexcept
Exchange the pointer and deleter with another object.
unique_ptr & operator=(unique_ptr &&)=default
Move assignment operator.
_GLIBCXX23_CONSTEXPR pointer operator->() const noexcept
Return the stored pointer.
~unique_ptr() noexcept
Destructor, invokes the deleter if the stored pointer is not null.
_GLIBCXX23_CONSTEXPR unique_ptr(pointer __p, const deleter_type &__d) noexcept
_GLIBCXX23_CONSTEXPR deleter_type & get_deleter() noexcept
Return a reference to the stored deleter.
_GLIBCXX23_CONSTEXPR add_lvalue_reference< element_type >::type operator*() const noexcept(noexcept(*std::declval< pointer >()))
Dereference the stored pointer.
_GLIBCXX23_CONSTEXPR unique_ptr(pointer __p) noexcept
_GLIBCXX23_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.
_GLIBCXX23_CONSTEXPR pointer release() noexcept
Release ownership of any stored pointer.
_GLIBCXX23_CONSTEXPR const deleter_type & get_deleter() const noexcept
Return a reference to the stored deleter.
constexpr unique_ptr(nullptr_t) noexcept
Creates a unique_ptr that owns nothing.
_GLIBCXX23_CONSTEXPR unique_ptr & operator=(nullptr_t) noexcept
Reset the unique_ptr to empty, invoking the deleter if necessary.
_GLIBCXX23_CONSTEXPR void reset(pointer __p=pointer()) noexcept
Replace the stored pointer.
constexpr unique_ptr(nullptr_t) noexcept
Creates a unique_ptr that owns nothing.
_GLIBCXX23_CONSTEXPR pointer release() noexcept
Release ownership of any stored pointer.
_GLIBCXX23_CONSTEXPR unique_ptr(_Up __p) noexcept
_GLIBCXX23_CONSTEXPR deleter_type & get_deleter() noexcept
Return a reference to the stored deleter.
unique_ptr & operator=(unique_ptr &&)=default
Move assignment operator.
_GLIBCXX23_CONSTEXPR std::add_lvalue_reference< element_type >::type operator[](size_t __i) const
Access an element of owned array.
constexpr unique_ptr() noexcept
Default constructor, creates a unique_ptr that owns nothing.
_GLIBCXX23_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.
_GLIBCXX23_CONSTEXPR unique_ptr(_Up __p, const deleter_type &__d) noexcept
unique_ptr(unique_ptr &&)=default
Move constructor.
_GLIBCXX23_CONSTEXPR void reset(_Up __p) noexcept
Replace the stored pointer.
~unique_ptr()
Destructor, invokes the deleter if the stored pointer is not null.
_GLIBCXX23_CONSTEXPR pointer get() const noexcept
Return the stored pointer.
_GLIBCXX23_CONSTEXPR void swap(unique_ptr &__u) noexcept
Exchange the pointer and deleter with another object.
_GLIBCXX23_CONSTEXPR unique_ptr(_Up __p, __enable_if_t<!is_lvalue_reference< _Del >::value, _Del && > __d) noexcept
_GLIBCXX23_CONSTEXPR const deleter_type & get_deleter() const noexcept
Return a reference to the stored deleter.
_GLIBCXX23_CONSTEXPR unique_ptr & operator=(nullptr_t) noexcept
Reset the unique_ptr to empty, invoking the deleter if necessary.