31#define _UNIQUE_PTR_H 1
39#if __cplusplus >= 202002L
47#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
48# define __cpp_lib_constexpr_memory 202202L
49#elif __cplusplus > 201703L
50# define __cpp_lib_constexpr_memory 201811L
53namespace std _GLIBCXX_VISIBILITY(default)
55_GLIBCXX_BEGIN_NAMESPACE_VERSION
62#if _GLIBCXX_USE_DEPRECATED
63#pragma GCC diagnostic push
64#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
65 template<
typename>
class auto_ptr;
66#pragma GCC diagnostic pop
74 template<
typename _Tp>
85 template<typename _Up,
86 typename = _Require<is_convertible<_Up*, _Tp*>>>
96 "can't delete pointer to incomplete type");
97 static_assert(
sizeof(_Tp)>0,
98 "can't delete pointer to incomplete type");
111 template<
typename _Tp>
127 template<typename _Up,
128 typename = _Require<is_convertible<_Up(*)[], _Tp(*)[]>>>
133 template<
typename _Up>
135 typename enable_if<is_convertible<_Up(*)[], _Tp(*)[]>::value>::type
138 static_assert(
sizeof(_Tp)>0,
139 "can't delete pointer to incomplete type");
147 template <
typename _Tp,
typename _Dp>
148 class __uniq_ptr_impl
150 template <
typename _Up,
typename _Ep,
typename =
void>
156 template <
typename _Up,
typename _Ep>
158 _Ptr<_Up, _Ep, __void_t<typename remove_reference<_Ep>::type::pointer>>
160 using type =
typename remove_reference<_Ep>::type::pointer;
164 using _DeleterConstraint = enable_if<
165 __and_<__not_<is_pointer<_Dp>>,
166 is_default_constructible<_Dp>>::value>;
168 using pointer =
typename _Ptr<_Tp, _Dp>::type;
170 static_assert( !is_rvalue_reference<_Dp>::value,
171 "unique_ptr's deleter type must be a function object type"
172 " or an lvalue reference type" );
174 __uniq_ptr_impl() =
default;
176 __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; }
178 template<
typename _Del>
180 __uniq_ptr_impl(pointer __p, _Del&& __d)
184 __uniq_ptr_impl(__uniq_ptr_impl&& __u) noexcept
186 { __u._M_ptr() =
nullptr; }
189 __uniq_ptr_impl& operator=(__uniq_ptr_impl&& __u)
noexcept
191 reset(__u.release());
192 _M_deleter() = std::forward<_Dp>(__u._M_deleter());
197 pointer& _M_ptr() noexcept {
return std::get<0>(_M_t); }
199 pointer _M_ptr() const noexcept {
return std::get<0>(_M_t); }
201 _Dp& _M_deleter() noexcept {
return std::get<1>(_M_t); }
203 const _Dp& _M_deleter() const noexcept {
return std::get<1>(_M_t); }
206 void reset(pointer __p)
noexcept
208 const pointer __old_p = _M_ptr();
211 _M_deleter()(__old_p);
215 pointer release() noexcept
217 pointer __p = _M_ptr();
224 swap(__uniq_ptr_impl& __rhs)
noexcept
227 swap(this->_M_ptr(), __rhs._M_ptr());
228 swap(this->_M_deleter(), __rhs._M_deleter());
232 tuple<pointer, _Dp> _M_t;
236 template <
typename _Tp,
typename _Dp,
237 bool = is_move_constructible<_Dp>::value,
238 bool = is_move_assignable<_Dp>::value>
239 struct __uniq_ptr_data : __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&&) =
default;
246 template <
typename _Tp,
typename _Dp>
247 struct __uniq_ptr_data<_Tp, _Dp, true, false> : __uniq_ptr_impl<_Tp, _Dp>
249 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
250 __uniq_ptr_data(__uniq_ptr_data&&) =
default;
251 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
254 template <
typename _Tp,
typename _Dp>
255 struct __uniq_ptr_data<_Tp, _Dp, false, true> : __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&&) =
default;
262 template <
typename _Tp,
typename _Dp>
263 struct __uniq_ptr_data<_Tp, _Dp, false, false> : __uniq_ptr_impl<_Tp, _Dp>
265 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
266 __uniq_ptr_data(__uniq_ptr_data&&) =
delete;
267 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
276 template <
typename _Tp,
typename _Dp = default_delete<_Tp>>
279 template <
typename _Up>
280 using _DeleterConstraint =
281 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
283 __uniq_ptr_data<_Tp, _Dp> _M_t;
286 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
287 using element_type = _Tp;
288 using deleter_type = _Dp;
293 template<
typename _Up,
typename _Ep>
294 using __safe_conversion_up = __and_<
295 is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>,
296 __not_<is_array<_Up>>
303 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
314 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
328 template<
typename _Del = deleter_type,
329 typename = _Require<is_copy_constructible<_Del>>>
341 template<
typename _Del = deleter_type,
342 typename = _Require<is_move_constructible<_Del>>>
346 _Del&&> __d) noexcept
350 template<
typename _Del = deleter_type,
351 typename _DelUnref =
typename remove_reference<_Del>::type>
355 _DelUnref&&>) =
delete;
358 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
374 template<
typename _Up,
typename _Ep,
typename = _Require<
375 __safe_conversion_up<_Up, _Ep>,
376 __conditional_t<is_reference<_Dp>::value,
378 is_convertible<_Ep, _Dp>>>>
381 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
384#if _GLIBCXX_USE_DEPRECATED
385#pragma GCC diagnostic push
386#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
388 template<
typename _Up,
typename = _Require<
391#pragma GCC diagnostic pop
395#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
400 static_assert(__is_invocable<deleter_type&, pointer>::value,
401 "unique_ptr's deleter must be invocable with a pointer");
402 auto& __ptr = _M_t._M_ptr();
403 if (__ptr !=
nullptr)
423 template<
typename _Up,
typename _Ep>
426 __safe_conversion_up<_Up, _Ep>,
432 reset(__u.release());
433 get_deleter() = std::forward<_Ep>(__u.get_deleter());
450 typename add_lvalue_reference<element_type>::type
453 __glibcxx_assert(
get() != pointer());
462 _GLIBCXX_DEBUG_PEDASSERT(
get() != pointer());
470 {
return _M_t._M_ptr(); }
476 {
return _M_t._M_deleter(); }
482 {
return _M_t._M_deleter(); }
486 explicit operator bool() const noexcept
487 {
return get() == pointer() ? false :
true; }
495 {
return _M_t.release(); }
505 reset(pointer __p = pointer()) noexcept
507 static_assert(__is_invocable<deleter_type&, pointer>::value,
508 "unique_ptr's deleter must be invocable with a pointer");
517 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
534 template<
typename _Tp,
typename _Dp>
537 template <
typename _Up>
538 using _DeleterConstraint =
539 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
541 __uniq_ptr_data<_Tp, _Dp> _M_t;
544 template<
typename _Up>
545 using __is_derived_Tp
546 = __and_< is_base_of<_Tp, _Up>,
547 __not_<is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up>>> >;
550 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
551 using element_type = _Tp;
552 using deleter_type = _Dp;
556 template<
typename _Up,
typename _Ep,
558 typename _UP_pointer =
typename _UPtr::pointer,
559 typename _UP_element_type =
typename _UPtr::element_type>
560 using __safe_conversion_up = __and_<
564 is_convertible<_UP_element_type(*)[], element_type(*)[]>
568 template<
typename _Up>
569 using __safe_conversion_raw = __and_<
570 __or_<__or_<is_same<_Up, pointer>,
572 __and_<is_pointer<_Up>,
575 typename remove_pointer<_Up>::type(*)[],
584 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
596 template<
typename _Up,
598 typename = _DeleterConstraint<_Vp>,
600 __safe_conversion_raw<_Up>::value,
bool>::type>
615 template<
typename _Up,
typename _Del = deleter_type,
616 typename = _Require<__safe_conversion_raw<_Up>,
630 template<
typename _Up,
typename _Del = deleter_type,
631 typename = _Require<__safe_conversion_raw<_Up>,
636 _Del&&> __d) noexcept
640 template<
typename _Up,
typename _Del = deleter_type,
641 typename _DelUnref =
typename remove_reference<_Del>::type,
642 typename = _Require<__safe_conversion_raw<_Up>>>
645 _DelUnref&&>) =
delete;
651 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
656 template<
typename _Up,
typename _Ep,
typename = _Require<
657 __safe_conversion_up<_Up, _Ep>,
658 __conditional_t<is_reference<_Dp>::value,
660 is_convertible<_Ep, _Dp>>>>
663 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
667#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
672 auto& __ptr = _M_t._M_ptr();
673 if (__ptr !=
nullptr)
694 template<
typename _Up,
typename _Ep>
703 reset(__u.release());
704 get_deleter() = std::forward<_Ep>(__u.get_deleter());
721 typename std::add_lvalue_reference<element_type>::type
724 __glibcxx_assert(
get() != pointer());
732 {
return _M_t._M_ptr(); }
738 {
return _M_t._M_deleter(); }
744 {
return _M_t._M_deleter(); }
748 explicit operator bool() const noexcept
749 {
return get() == pointer() ? false :
true; }
757 {
return _M_t.release(); }
765 template <
typename _Up,
767 __or_<is_same<_Up, pointer>,
768 __and_<is_same<pointer, element_type*>,
771 typename remove_pointer<_Up>::type(*)[],
783 void reset(nullptr_t =
nullptr) noexcept
784 {
reset(pointer()); }
791 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
804 template<
typename _Tp,
typename _Dp>
806#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
809 typename enable_if<__is_swappable<_Dp>::value>::type
817#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
818 template<
typename _Tp,
typename _Dp>
825 template<
typename _Tp,
typename _Dp,
826 typename _Up,
typename _Ep>
827 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
831 {
return __x.
get() == __y.
get(); }
834 template<
typename _Tp,
typename _Dp>
835 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
840#ifndef __cpp_lib_three_way_comparison
842 template<
typename _Tp,
typename _Dp>
849 template<
typename _Tp,
typename _Dp,
850 typename _Up,
typename _Ep>
855 {
return __x.
get() != __y.
get(); }
858 template<
typename _Tp,
typename _Dp>
862 {
return (
bool)__x; }
865 template<
typename _Tp,
typename _Dp>
869 {
return (
bool)__x; }
873 template<
typename _Tp,
typename _Dp,
874 typename _Up,
typename _Ep>
875 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
882 typename unique_ptr<_Up, _Ep>::pointer>::type _CT;
887 template<
typename _Tp,
typename _Dp>
888 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
897 template<
typename _Tp,
typename _Dp>
898 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
907 template<
typename _Tp,
typename _Dp,
908 typename _Up,
typename _Ep>
909 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
913 {
return !(__y < __x); }
916 template<
typename _Tp,
typename _Dp>
917 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
920 {
return !(
nullptr < __x); }
923 template<
typename _Tp,
typename _Dp>
924 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
927 {
return !(__x <
nullptr); }
930 template<
typename _Tp,
typename _Dp,
931 typename _Up,
typename _Ep>
932 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
936 {
return (__y < __x); }
939 template<
typename _Tp,
typename _Dp>
940 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
949 template<
typename _Tp,
typename _Dp>
950 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
959 template<
typename _Tp,
typename _Dp,
960 typename _Up,
typename _Ep>
961 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
965 {
return !(__x < __y); }
968 template<
typename _Tp,
typename _Dp>
969 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
972 {
return !(__x <
nullptr); }
975 template<
typename _Tp,
typename _Dp>
976 _GLIBCXX_NODISCARD
inline bool
978 {
return !(
nullptr < __x); }
980#ifdef __cpp_lib_three_way_comparison
981 template<
typename _Tp,
typename _Dp,
typename _Up,
typename _Ep>
982 requires three_way_comparable_with<typename unique_ptr<_Tp, _Dp>::pointer,
983 typename unique_ptr<_Up, _Ep>::pointer>
986 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer,
987 typename unique_ptr<_Up, _Ep>::pointer>
988 operator<=>(
const unique_ptr<_Tp, _Dp>& __x,
989 const unique_ptr<_Up, _Ep>& __y)
990 {
return compare_three_way()(__x.get(), __y.get()); }
992 template<
typename _Tp,
typename _Dp>
993 requires three_way_comparable<typename unique_ptr<_Tp, _Dp>::pointer>
996 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer>
997 operator<=>(
const unique_ptr<_Tp, _Dp>& __x, nullptr_t)
999 using pointer =
typename unique_ptr<_Tp, _Dp>::pointer;
1000 return compare_three_way()(__x.get(),
static_cast<pointer
>(
nullptr));
1006 template<
typename _Up,
typename _Ptr =
typename _Up::pointer,
1007 bool = __poison_hash<_Ptr>::__enable_hash_call>
1008 struct __uniq_ptr_hash
1009#if ! _GLIBCXX_INLINE_VERSION
1010 :
private __poison_hash<_Ptr>
1014 operator()(
const _Up& __u)
const
1015 noexcept(
noexcept(std::declval<hash<_Ptr>>()(std::declval<_Ptr>())))
1016 {
return hash<_Ptr>()(__u.get()); }
1019 template<
typename _Up,
typename _Ptr>
1020 struct __uniq_ptr_hash<_Up, _Ptr, false>
1021 :
private __poison_hash<_Ptr>
1026 template<
typename _Tp,
typename _Dp>
1028 :
public __hash_base<size_t, unique_ptr<_Tp, _Dp>>,
1029 public __uniq_ptr_hash<unique_ptr<_Tp, _Dp>>
1032#if __cplusplus >= 201402L && _GLIBCXX_HOSTED
1033#define __cpp_lib_make_unique 201304L
1038 template<
typename _Tp>
1042 template<
typename _Tp>
1043 struct _MakeUniq<_Tp[]>
1044 {
typedef unique_ptr<_Tp[]> __array; };
1046 template<
typename _Tp,
size_t _Bound>
1047 struct _MakeUniq<_Tp[_Bound]>
1048 {
struct __invalid_type { }; };
1050 template<
typename _Tp>
1051 using __unique_ptr_t =
typename _MakeUniq<_Tp>::__single_object;
1052 template<
typename _Tp>
1053 using __unique_ptr_array_t =
typename _MakeUniq<_Tp>::__array;
1054 template<
typename _Tp>
1055 using __invalid_make_unique_t =
typename _MakeUniq<_Tp>::__invalid_type;
1066 template<
typename _Tp,
typename... _Args>
1067 _GLIBCXX23_CONSTEXPR
1068 inline __detail::__unique_ptr_t<_Tp>
1081 template<
typename _Tp>
1082 _GLIBCXX23_CONSTEXPR
1083 inline __detail::__unique_ptr_array_t<_Tp>
1092 template<
typename _Tp,
typename... _Args>
1093 __detail::__invalid_make_unique_t<_Tp>
1096#if __cplusplus > 201703L
1103 template<
typename _Tp>
1104 _GLIBCXX23_CONSTEXPR
1105 inline __detail::__unique_ptr_t<_Tp>
1116 template<
typename _Tp>
1117 _GLIBCXX23_CONSTEXPR
1118 inline __detail::__unique_ptr_array_t<_Tp>
1127 template<
typename _Tp,
typename... _Args>
1128 __detail::__invalid_make_unique_t<_Tp>
1134#if __cplusplus > 201703L && __cpp_concepts && _GLIBCXX_HOSTED
1140 template<
typename _CharT,
typename _Traits,
typename _Tp,
typename _Dp>
1144 requires requires { __os << __p.
get(); }
1153#if __cplusplus >= 201703L
1154 namespace __detail::__variant
1156 template<
typename>
struct _Never_valueless_alt;
1160 template<
typename _Tp,
typename _Del>
1161 struct _Never_valueless_alt<
std::unique_ptr<_Tp, _Del>>
1167_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)
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.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
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 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.
constexpr pointer operator->() 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 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.
unique_ptr & operator=(unique_ptr &&)=default
Move assignment operator.
constexpr void reset(pointer __p=pointer()) noexcept
Replace 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.
~unique_ptr() noexcept
Destructor, invokes the deleter if the stored pointer is not null.
constexpr unique_ptr(unique_ptr< _Up, _Ep > &&__u) noexcept
Converting constructor from another type.
constexpr deleter_type & get_deleter() noexcept
Return a reference to the stored deleter.
constexpr add_lvalue_reference< element_type >::type operator*() const noexcept(noexcept(*std::declval< pointer >()))
Dereference the stored pointer.
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(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.
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.
constexpr pointer release() noexcept
Release ownership of any stored pointer.
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.
constexpr const deleter_type & get_deleter() const noexcept
Return a reference to the stored deleter.
constexpr unique_ptr & operator=(nullptr_t) noexcept
Reset the unique_ptr to empty, invoking the deleter if necessary.
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 unique_ptr(_Up __p, __enable_if_t<!is_lvalue_reference< _Del >::value, _Del && > __d) noexcept
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) noexcept
unique_ptr & operator=(unique_ptr &&)=default
Move assignment operator.
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 std::add_lvalue_reference< element_type >::type operator[](size_t __i) const
Access an element of owned array.