@@ -57,9 +57,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* __construct_at(_Tp* __l
5757// The internal functions are available regardless of the language version (with the exception of the `__destroy_at`
5858// taking an array).
5959
60- template <class _ForwardIterator >
61- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator __destroy (_ForwardIterator, _ForwardIterator);
62-
6360template <class _Tp , __enable_if_t <!is_array<_Tp>::value, int > = 0 >
6461_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at (_Tp* __loc) {
6562 _LIBCPP_ASSERT_NON_NULL (__loc != nullptr , " null pointer given to destroy_at" );
@@ -70,28 +67,12 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc
7067template <class _Tp , __enable_if_t <is_array<_Tp>::value, int > = 0 >
7168_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at (_Tp* __loc) {
7269 _LIBCPP_ASSERT_NON_NULL (__loc != nullptr , " null pointer given to destroy_at" );
73- std::__destroy (std::begin (*__loc), std::end (*__loc));
70+ auto const __end = std::end (*__loc);
71+ for (auto __it = std::begin (*__loc); __it != __end; ++__it)
72+ std::__destroy_at (*__it);
7473}
7574#endif
7675
77- template <class _ForwardIterator >
78- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
79- __destroy (_ForwardIterator __first, _ForwardIterator __last) {
80- for (; __first != __last; ++__first)
81- std::__destroy_at (std::addressof (*__first));
82- return __first;
83- }
84-
85- template <class _BidirectionalIterator >
86- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator
87- __reverse_destroy (_BidirectionalIterator __first, _BidirectionalIterator __last) {
88- while (__last != __first) {
89- --__last;
90- std::__destroy_at (std::addressof (*__last));
91- }
92- return __last;
93- }
94-
9576#if _LIBCPP_STD_VER >= 17
9677
9778template <class _Tp , enable_if_t <!is_array_v<_Tp>, int > = 0 >
@@ -106,18 +87,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc)
10687}
10788# endif
10889
109- template <class _ForwardIterator >
110- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy (_ForwardIterator __first, _ForwardIterator __last) {
111- (void )std::__destroy (std::move (__first), std::move (__last));
112- }
113-
114- template <class _ForwardIterator , class _Size >
115- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator destroy_n (_ForwardIterator __first, _Size __n) {
116- for (; __n > 0 ; (void )++__first, --__n)
117- std::__destroy_at (std::addressof (*__first));
118- return __first;
119- }
120-
12190#endif // _LIBCPP_STD_VER >= 17
12291
12392_LIBCPP_END_NAMESPACE_STD
0 commit comments