@@ -64,11 +64,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
6464template <class _Tp >
6565struct _LIBCPP_TEMPLATE_VIS default_delete {
6666 static_assert (!is_function<_Tp>::value, " default_delete cannot be instantiated for function types" );
67- #ifndef _LIBCPP_CXX03_LANG
68- _LIBCPP_HIDE_FROM_ABI constexpr default_delete () _NOEXCEPT = default;
69- #else
70- _LIBCPP_HIDE_FROM_ABI default_delete () {}
71- #endif
67+
68+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR default_delete () _NOEXCEPT = default;
69+
7270 template <class _Up , __enable_if_t <is_convertible<_Up*, _Tp*>::value, int > = 0 >
7371 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete (const default_delete<_Up>&) _NOEXCEPT {}
7472
@@ -81,34 +79,23 @@ struct _LIBCPP_TEMPLATE_VIS default_delete {
8179
8280template <class _Tp >
8381struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> {
84- private:
85- template <class _Up >
86- struct _EnableIfConvertible : enable_if<is_convertible<_Up (*)[], _Tp (*)[]>::value> {};
82+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR default_delete () _NOEXCEPT = default;
8783
88- public:
89- #ifndef _LIBCPP_CXX03_LANG
90- _LIBCPP_HIDE_FROM_ABI constexpr default_delete () _NOEXCEPT = default;
91- #else
92- _LIBCPP_HIDE_FROM_ABI default_delete () {}
93- #endif
94-
95- template <class _Up >
96- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
97- default_delete (const default_delete<_Up[]>&, typename _EnableIfConvertible<_Up>::type* = 0 ) _NOEXCEPT {}
84+ template <class _Up , __enable_if_t <is_convertible<_Up (*)[], _Tp (*)[]>::value, int > = 0 >
85+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete (const default_delete<_Up[]>&) _NOEXCEPT {}
9886
99- template <class _Up >
100- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename _EnableIfConvertible<_Up>::type
101- operator ()(_Up* __ptr) const _NOEXCEPT {
87+ template <class _Up , __enable_if_t <is_convertible<_Up (*)[], _Tp (*)[]>::value, int > = 0 >
88+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator ()(_Up* __ptr) const _NOEXCEPT {
10289 static_assert (sizeof (_Up) >= 0 , " cannot delete an incomplete type" );
10390 delete[] __ptr;
10491 }
10592};
10693
10794template <class _Deleter >
108- struct __is_default_deleter : false_type {} ;
95+ inline const bool __is_default_deleter_v = false ;
10996
11097template <class _Tp >
111- struct __is_default_deleter <default_delete<_Tp> > : true_type {} ;
98+ inline const bool __is_default_deleter_v <default_delete<_Tp> > = true ;
11299
113100template <class _Deleter >
114101struct __unique_ptr_deleter_sfinae {
@@ -355,7 +342,7 @@ struct __unique_ptr_array_bounds_stateless {
355342
356343 template <class _Deleter ,
357344 class _Tp ,
358- __enable_if_t <__is_default_deleter <_Deleter>::value && __has_array_cookie<_Tp>::value, int > = 0 >
345+ __enable_if_t <__is_default_deleter_v <_Deleter> && __has_array_cookie<_Tp>::value, int > = 0 >
359346 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __in_bounds (_Tp* __ptr, size_t __index) const {
360347 // In constant expressions, we can't check the array cookie so we just pretend that the index
361348 // is in-bounds. The compiler catches invalid accesses anyway.
@@ -367,7 +354,7 @@ struct __unique_ptr_array_bounds_stateless {
367354
368355 template <class _Deleter ,
369356 class _Tp ,
370- __enable_if_t <!__is_default_deleter <_Deleter>::value || !__has_array_cookie<_Tp>::value, int > = 0 >
357+ __enable_if_t <!__is_default_deleter_v <_Deleter> || !__has_array_cookie<_Tp>::value, int > = 0 >
371358 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __in_bounds (_Tp*, size_t ) const {
372359 return true ; // If we don't have an array cookie, we assume the access is in-bounds
373360 }
@@ -385,7 +372,7 @@ struct __unique_ptr_array_bounds_stored {
385372 // Use the array cookie if there's one
386373 template <class _Deleter ,
387374 class _Tp ,
388- __enable_if_t <__is_default_deleter <_Deleter>::value && __has_array_cookie<_Tp>::value, int > = 0 >
375+ __enable_if_t <__is_default_deleter_v <_Deleter> && __has_array_cookie<_Tp>::value, int > = 0 >
389376 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __in_bounds (_Tp* __ptr, size_t __index) const {
390377 if (__libcpp_is_constant_evaluated ())
391378 return true ;
@@ -396,7 +383,7 @@ struct __unique_ptr_array_bounds_stored {
396383 // Otherwise, fall back on the stored size (if any)
397384 template <class _Deleter ,
398385 class _Tp ,
399- __enable_if_t <!__is_default_deleter <_Deleter>::value || !__has_array_cookie<_Tp>::value, int > = 0 >
386+ __enable_if_t <!__is_default_deleter_v <_Deleter> || !__has_array_cookie<_Tp>::value, int > = 0 >
400387 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __in_bounds (_Tp*, size_t __index) const {
401388 return __index < __size_;
402389 }
0 commit comments