16
16
#include < __iterator/advance.h>
17
17
#include < __iterator/distance.h>
18
18
#include < __iterator/iterator_traits.h>
19
+ #include < __memory/construct_at.h>
19
20
#include < __memory/destruct_n.h>
20
21
#include < __memory/unique_ptr.h>
21
22
#include < __memory/unique_temporary_buffer.h>
@@ -33,7 +34,7 @@ _LIBCPP_PUSH_MACROS
33
34
_LIBCPP_BEGIN_NAMESPACE_STD
34
35
35
36
template <class _AlgPolicy , class _Predicate , class _ForwardIterator , class _Distance , class _Pair >
36
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl (
37
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator __stable_partition_impl (
37
38
_ForwardIterator __first,
38
39
_ForwardIterator __last,
39
40
_Predicate __pred,
@@ -61,7 +62,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
61
62
// Move the falses into the temporary buffer, and the trues to the front of the line
62
63
// Update __first to always point to the end of the trues
63
64
value_type* __t = __p.first ;
64
- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__first));
65
+ std::__construct_at ( __t , _Ops::__iter_move (__first));
65
66
__d.template __incr <value_type>();
66
67
++__t ;
67
68
_ForwardIterator __i = __first;
@@ -70,7 +71,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
70
71
*__first = _Ops::__iter_move (__i);
71
72
++__first;
72
73
} else {
73
- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__i));
74
+ std::__construct_at ( __t , _Ops::__iter_move (__i));
74
75
__d.template __incr <value_type>();
75
76
++__t ;
76
77
}
@@ -116,7 +117,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
116
117
}
117
118
118
119
template <class _AlgPolicy , class _Predicate , class _ForwardIterator >
119
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator
120
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
120
121
__stable_partition_impl (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) {
121
122
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
122
123
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
@@ -145,7 +146,7 @@ __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Pred
145
146
}
146
147
147
148
template <class _AlgPolicy , class _Predicate , class _BidirectionalIterator , class _Distance , class _Pair >
148
- _BidirectionalIterator __stable_partition_impl (
149
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _BidirectionalIterator __stable_partition_impl (
149
150
_BidirectionalIterator __first,
150
151
_BidirectionalIterator __last,
151
152
_Predicate __pred,
@@ -179,7 +180,7 @@ _BidirectionalIterator __stable_partition_impl(
179
180
// Move the falses into the temporary buffer, and the trues to the front of the line
180
181
// Update __first to always point to the end of the trues
181
182
value_type* __t = __p.first ;
182
- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__first));
183
+ std::__construct_at ( __t , _Ops::__iter_move (__first));
183
184
__d.template __incr <value_type>();
184
185
++__t ;
185
186
_BidirectionalIterator __i = __first;
@@ -188,7 +189,7 @@ _BidirectionalIterator __stable_partition_impl(
188
189
*__first = _Ops::__iter_move (__i);
189
190
++__first;
190
191
} else {
191
- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__i));
192
+ std::__construct_at ( __t , _Ops::__iter_move (__i));
192
193
__d.template __incr <value_type>();
193
194
++__t ;
194
195
}
@@ -247,7 +248,7 @@ _BidirectionalIterator __stable_partition_impl(
247
248
}
248
249
249
250
template <class _AlgPolicy , class _Predicate , class _BidirectionalIterator >
250
- _LIBCPP_HIDE_FROM_ABI _BidirectionalIterator __stable_partition_impl (
251
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _BidirectionalIterator __stable_partition_impl (
251
252
_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, bidirectional_iterator_tag) {
252
253
typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
253
254
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
@@ -283,14 +284,14 @@ _LIBCPP_HIDE_FROM_ABI _BidirectionalIterator __stable_partition_impl(
283
284
}
284
285
285
286
template <class _AlgPolicy , class _Predicate , class _ForwardIterator , class _IterCategory >
286
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition (
287
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator __stable_partition (
287
288
_ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred, _IterCategory __iter_category) {
288
289
return std::__stable_partition_impl<_AlgPolicy, __remove_cvref_t <_Predicate>&>(
289
290
std::move (__first), std::move (__last), __pred, __iter_category);
290
291
}
291
292
292
293
template <class _ForwardIterator , class _Predicate >
293
- inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
294
+ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
294
295
stable_partition (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
295
296
using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
296
297
return std::__stable_partition<_ClassicAlgPolicy, _Predicate&>(
0 commit comments