31#define _UNIQUE_PTR_H 1
39#if __cplusplus >= 202002L
46#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
47# if __cpp_lib_constexpr_memory < 202202L
49# undef __cpp_lib_constexpr_memory
50# define __cpp_lib_constexpr_memory 202202L
54namespace std _GLIBCXX_VISIBILITY(default)
56_GLIBCXX_BEGIN_NAMESPACE_VERSION
63#if _GLIBCXX_USE_DEPRECATED
64#pragma GCC diagnostic push
65#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
66 template<
typename>
class auto_ptr;
67#pragma GCC diagnostic pop
75 template<
typename _Tp>
86 template<typename _Up,
87 typename = _Require<is_convertible<_Up*, _Tp*>>>
97 "can't delete pointer to incomplete type");
98 static_assert(
sizeof(_Tp)>0,
99 "can't delete pointer to incomplete type");
112 template<
typename _Tp>
128 template<typename _Up,
129 typename = _Require<is_convertible<_Up(*)[], _Tp(*)[]>>>
134 template<
typename _Up>
136 typename enable_if<is_convertible<_Up(*)[], _Tp(*)[]>::value>::type
139 static_assert(
sizeof(_Tp)>0,
140 "can't delete pointer to incomplete type");
148 template <
typename _Tp,
typename _Dp>
149 class __uniq_ptr_impl
151 template <
typename _Up,
typename _Ep,
typename =
void>
157 template <
typename _Up,
typename _Ep>
159 _Ptr<_Up, _Ep, __void_t<typename remove_reference<_Ep>::type::pointer>>
161 using type =
typename remove_reference<_Ep>::type::pointer;
165 using _DeleterConstraint = enable_if<
166 __and_<__not_<is_pointer<_Dp>>,
167 is_default_constructible<_Dp>>::value>;
169 using pointer =
typename _Ptr<_Tp, _Dp>::type;
171 static_assert( !is_rvalue_reference<_Dp>::value,
172 "unique_ptr's deleter type must be a function object type"
173 " or an lvalue reference type" );
175 __uniq_ptr_impl() =
default;
177 __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; }
179 template<
typename _Del>
181 __uniq_ptr_impl(pointer __p, _Del&& __d)
185 __uniq_ptr_impl(__uniq_ptr_impl&& __u) noexcept
187 { __u._M_ptr() =
nullptr; }
190 __uniq_ptr_impl& operator=(__uniq_ptr_impl&& __u)
noexcept
192 reset(__u.release());
193 _M_deleter() = std::forward<_Dp>(__u._M_deleter());
198 pointer& _M_ptr() noexcept {
return std::get<0>(_M_t); }
200 pointer _M_ptr() const noexcept {
return std::get<0>(_M_t); }
202 _Dp& _M_deleter() noexcept {
return std::get<1>(_M_t); }
204 const _Dp& _M_deleter() const noexcept {
return std::get<1>(_M_t); }
207 void reset(pointer __p)
noexcept
209 const pointer __old_p = _M_ptr();
212 _M_deleter()(__old_p);
216 pointer release() noexcept
218 pointer __p = _M_ptr();
225 swap(__uniq_ptr_impl& __rhs)
noexcept
228 swap(this->_M_ptr(), __rhs._M_ptr());
229 swap(this->_M_deleter(), __rhs._M_deleter());
233 tuple<pointer, _Dp> _M_t;
237 template <
typename _Tp,
typename _Dp,
238 bool = is_move_constructible<_Dp>::value,
239 bool = is_move_assignable<_Dp>::value>
240 struct __uniq_ptr_data : __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&&) =
default;
247 template <
typename _Tp,
typename _Dp>
248 struct __uniq_ptr_data<_Tp, _Dp, true, false> : __uniq_ptr_impl<_Tp, _Dp>
250 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
251 __uniq_ptr_data(__uniq_ptr_data&&) =
default;
252 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
255 template <
typename _Tp,
typename _Dp>
256 struct __uniq_ptr_data<_Tp, _Dp, false, true> : __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&&) =
default;
263 template <
typename _Tp,
typename _Dp>
264 struct __uniq_ptr_data<_Tp, _Dp, false, false> : __uniq_ptr_impl<_Tp, _Dp>
266 using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl;
267 __uniq_ptr_data(__uniq_ptr_data&&) =
delete;
268 __uniq_ptr_data& operator=(__uniq_ptr_data&&) =
delete;
277 template <
typename _Tp,
typename _Dp = default_delete<_Tp>>
280 template <
typename _Up>
281 using _DeleterConstraint =
282 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
284 __uniq_ptr_data<_Tp, _Dp> _M_t;
287 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
288 using element_type = _Tp;
289 using deleter_type = _Dp;
294 template<
typename _Up,
typename _Ep>
295 using __safe_conversion_up = __and_<
296 is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>,
297 __not_<is_array<_Up>>
304 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
315 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
329 template<
typename _Del = deleter_type,
330 typename = _Require<is_copy_constructible<_Del>>>
342 template<
typename _Del = deleter_type,
343 typename = _Require<is_move_constructible<_Del>>>
347 _Del&&> __d) noexcept
351 template<
typename _Del = deleter_type,
352 typename _DelUnref =
typename remove_reference<_Del>::type>
356 _DelUnref&&>) =
delete;
359 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
375 template<
typename _Up,
typename _Ep,
typename = _Require<
376 __safe_conversion_up<_Up, _Ep>,
377 __conditional_t<is_reference<_Dp>::value,
379 is_convertible<_Ep, _Dp>>>>
382 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
385#if _GLIBCXX_USE_DEPRECATED
386#pragma GCC diagnostic push
387#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
389 template<
typename _Up,
typename = _Require<
392#pragma GCC diagnostic pop
396#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
401 static_assert(__is_invocable<deleter_type&, pointer>::value,
402 "unique_ptr's deleter must be invocable with a pointer");
403 auto& __ptr = _M_t._M_ptr();
404 if (__ptr !=
nullptr)
424 template<
typename _Up,
typename _Ep>
427 __safe_conversion_up<_Up, _Ep>,
433 reset(__u.release());
434 get_deleter() = std::forward<_Ep>(__u.get_deleter());
451 typename add_lvalue_reference<element_type>::type
454 __glibcxx_assert(
get() != pointer());
463 _GLIBCXX_DEBUG_PEDASSERT(
get() != pointer());
471 {
return _M_t._M_ptr(); }
477 {
return _M_t._M_deleter(); }
483 {
return _M_t._M_deleter(); }
487 explicit operator bool() const noexcept
488 {
return get() == pointer() ? false :
true; }
496 {
return _M_t.release(); }
506 reset(pointer __p = pointer()) noexcept
508 static_assert(__is_invocable<deleter_type&, pointer>::value,
509 "unique_ptr's deleter must be invocable with a pointer");
518 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
535 template<
typename _Tp,
typename _Dp>
538 template <
typename _Up>
539 using _DeleterConstraint =
540 typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type;
542 __uniq_ptr_data<_Tp, _Dp> _M_t;
545 template<
typename _Up>
546 using __is_derived_Tp
547 = __and_< is_base_of<_Tp, _Up>,
548 __not_<is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up>>> >;
551 using pointer =
typename __uniq_ptr_impl<_Tp, _Dp>::pointer;
552 using element_type = _Tp;
553 using deleter_type = _Dp;
557 template<
typename _Up,
typename _Ep,
559 typename _UP_pointer =
typename _UPtr::pointer,
560 typename _UP_element_type =
typename _UPtr::element_type>
561 using __safe_conversion_up = __and_<
565 is_convertible<_UP_element_type(*)[], element_type(*)[]>
569 template<
typename _Up>
570 using __safe_conversion_raw = __and_<
571 __or_<__or_<is_same<_Up, pointer>,
573 __and_<is_pointer<_Up>,
576 typename remove_pointer<_Up>::type(*)[],
585 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
597 template<
typename _Up,
599 typename = _DeleterConstraint<_Vp>,
601 __safe_conversion_raw<_Up>::value,
bool>::type>
616 template<
typename _Up,
typename _Del = deleter_type,
617 typename = _Require<__safe_conversion_raw<_Up>,
631 template<
typename _Up,
typename _Del = deleter_type,
632 typename = _Require<__safe_conversion_raw<_Up>,
637 _Del&&> __d) noexcept
641 template<
typename _Up,
typename _Del = deleter_type,
642 typename _DelUnref =
typename remove_reference<_Del>::type,
643 typename = _Require<__safe_conversion_raw<_Up>>>
646 _DelUnref&&>) =
delete;
652 template<
typename _Del = _Dp,
typename = _DeleterConstra
int<_Del>>
657 template<
typename _Up,
typename _Ep,
typename = _Require<
658 __safe_conversion_up<_Up, _Ep>,
659 __conditional_t<is_reference<_Dp>::value,
661 is_convertible<_Ep, _Dp>>>>
664 : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
668#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
673 auto& __ptr = _M_t._M_ptr();
674 if (__ptr !=
nullptr)
695 template<
typename _Up,
typename _Ep>
704 reset(__u.release());
705 get_deleter() = std::forward<_Ep>(__u.get_deleter());
722 typename std::add_lvalue_reference<element_type>::type
725 __glibcxx_assert(
get() != pointer());
733 {
return _M_t._M_ptr(); }
739 {
return _M_t._M_deleter(); }
745 {
return _M_t._M_deleter(); }
749 explicit operator bool() const noexcept
750 {
return get() == pointer() ? false :
true; }
758 {
return _M_t.release(); }
766 template <
typename _Up,
768 __or_<is_same<_Up, pointer>,
769 __and_<is_same<pointer, element_type*>,
772 typename remove_pointer<_Up>::type(*)[],
784 void reset(nullptr_t =
nullptr) noexcept
785 {
reset(pointer()); }
792 static_assert(__is_swappable<_Dp>::value,
"deleter must be swappable");
805 template<
typename _Tp,
typename _Dp>
807#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
810 typename enable_if<__is_swappable<_Dp>::value>::type
818#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
819 template<
typename _Tp,
typename _Dp>
826 template<
typename _Tp,
typename _Dp,
827 typename _Up,
typename _Ep>
828 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
832 {
return __x.
get() == __y.
get(); }
835 template<
typename _Tp,
typename _Dp>
836 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
841#ifndef __cpp_lib_three_way_comparison
843 template<
typename _Tp,
typename _Dp>
850 template<
typename _Tp,
typename _Dp,
851 typename _Up,
typename _Ep>
856 {
return __x.
get() != __y.
get(); }
859 template<
typename _Tp,
typename _Dp>
863 {
return (
bool)__x; }
866 template<
typename _Tp,
typename _Dp>
870 {
return (
bool)__x; }
874 template<
typename _Tp,
typename _Dp,
875 typename _Up,
typename _Ep>
876 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
883 typename unique_ptr<_Up, _Ep>::pointer>::type _CT;
888 template<
typename _Tp,
typename _Dp>
889 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
898 template<
typename _Tp,
typename _Dp>
899 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
908 template<
typename _Tp,
typename _Dp,
909 typename _Up,
typename _Ep>
910 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
914 {
return !(__y < __x); }
917 template<
typename _Tp,
typename _Dp>
918 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
921 {
return !(
nullptr < __x); }
924 template<
typename _Tp,
typename _Dp>
925 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
928 {
return !(__x <
nullptr); }
931 template<
typename _Tp,
typename _Dp,
932 typename _Up,
typename _Ep>
933 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
937 {
return (__y < __x); }
940 template<
typename _Tp,
typename _Dp>
941 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
950 template<
typename _Tp,
typename _Dp>
951 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
960 template<
typename _Tp,
typename _Dp,
961 typename _Up,
typename _Ep>
962 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
966 {
return !(__x < __y); }
969 template<
typename _Tp,
typename _Dp>
970 _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR
973 {
return !(__x <
nullptr); }
976 template<
typename _Tp,
typename _Dp>
977 _GLIBCXX_NODISCARD
inline bool
979 {
return !(
nullptr < __x); }
981#ifdef __cpp_lib_three_way_comparison
982 template<
typename _Tp,
typename _Dp,
typename _Up,
typename _Ep>
983 requires three_way_comparable_with<typename unique_ptr<_Tp, _Dp>::pointer,
984 typename unique_ptr<_Up, _Ep>::pointer>
987 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer,
988 typename unique_ptr<_Up, _Ep>::pointer>
989 operator<=>(
const unique_ptr<_Tp, _Dp>& __x,
990 const unique_ptr<_Up, _Ep>& __y)
991 {
return compare_three_way()(__x.get(), __y.get()); }
993 template<
typename _Tp,
typename _Dp>
994 requires three_way_comparable<typename unique_ptr<_Tp, _Dp>::pointer>
997 compare_three_way_result_t<typename unique_ptr<_Tp, _Dp>::pointer>
998 operator<=>(
const unique_ptr<_Tp, _Dp>& __x, nullptr_t)
1000 using pointer =
typename unique_ptr<_Tp, _Dp>::pointer;
1001 return compare_three_way()(__x.get(),
static_cast<pointer
>(
nullptr));
1007 template<
typename _Up,
typename _Ptr =
typename _Up::pointer,
1008 bool = __poison_hash<_Ptr>::__enable_hash_call>
1009 struct __uniq_ptr_hash
1010#if ! _GLIBCXX_INLINE_VERSION
1011 :
private __poison_hash<_Ptr>
1015 operator()(
const _Up& __u)
const
1016 noexcept(
noexcept(std::declval<hash<_Ptr>>()(std::declval<_Ptr>())))
1017 {
return hash<_Ptr>()(__u.get()); }
1020 template<
typename _Up,
typename _Ptr>
1021 struct __uniq_ptr_hash<_Up, _Ptr, false>
1022 :
private __poison_hash<_Ptr>
1027 template<
typename _Tp,
typename _Dp>
1029 :
public __hash_base<size_t, unique_ptr<_Tp, _Dp>>,
1030 public __uniq_ptr_hash<unique_ptr<_Tp, _Dp>>
1033#if __cplusplus >= 201402L && _GLIBCXX_HOSTED
1034#define __cpp_lib_make_unique 201304L
1039 template<
typename _Tp>
1043 template<
typename _Tp>
1044 struct _MakeUniq<_Tp[]>
1045 {
typedef unique_ptr<_Tp[]> __array; };
1047 template<
typename _Tp,
size_t _Bound>
1048 struct _MakeUniq<_Tp[_Bound]>
1049 {
struct __invalid_type { }; };
1051 template<
typename _Tp>
1052 using __unique_ptr_t =
typename _MakeUniq<_Tp>::__single_object;
1053 template<
typename _Tp>
1054 using __unique_ptr_array_t =
typename _MakeUniq<_Tp>::__array;
1055 template<
typename _Tp>
1056 using __invalid_make_unique_t =
typename _MakeUniq<_Tp>::__invalid_type;
1067 template<
typename _Tp,
typename... _Args>
1068 _GLIBCXX23_CONSTEXPR
1069 inline __detail::__unique_ptr_t<_Tp>
1082 template<
typename _Tp>
1083 _GLIBCXX23_CONSTEXPR
1084 inline __detail::__unique_ptr_array_t<_Tp>
1093 template<
typename _Tp,
typename... _Args>
1094 __detail::__invalid_make_unique_t<_Tp>
1097#if __cplusplus > 201703L
1104 template<
typename _Tp>
1105 _GLIBCXX23_CONSTEXPR
1106 inline __detail::__unique_ptr_t<_Tp>
1117 template<
typename _Tp>
1118 _GLIBCXX23_CONSTEXPR
1119 inline __detail::__unique_ptr_array_t<_Tp>
1128 template<
typename _Tp,
typename... _Args>
1129 __detail::__invalid_make_unique_t<_Tp>
1135#if __cplusplus > 201703L && __cpp_concepts && _GLIBCXX_HOSTED
1141 template<
typename _CharT,
typename _Traits,
typename _Tp,
typename _Dp>
1145 requires requires { __os << __p.
get(); }
1154#if __cplusplus >= 201703L
1155 namespace __detail::__variant
1157 template<
typename>
struct _Never_valueless_alt;
1161 template<
typename _Tp,
typename _Del>
1162 struct _Never_valueless_alt<
std::unique_ptr<_Tp, _Del>>
1168_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.