1616#include < __iterator/advance.h>
1717#include < __iterator/distance.h>
1818#include < __iterator/iterator_traits.h>
19+ #include < __memory/construct_at.h>
1920#include < __memory/destruct_n.h>
2021#include < __memory/unique_ptr.h>
2122#include < __memory/unique_temporary_buffer.h>
@@ -33,7 +34,7 @@ _LIBCPP_PUSH_MACROS
3334_LIBCPP_BEGIN_NAMESPACE_STD
3435
3536template <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 (
3738 _ForwardIterator __first,
3839 _ForwardIterator __last,
3940 _Predicate __pred,
@@ -61,7 +62,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
6162 // Move the falses into the temporary buffer, and the trues to the front of the line
6263 // Update __first to always point to the end of the trues
6364 value_type* __t = __p.first ;
64- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__first));
65+ std::__construct_at ( __t , _Ops::__iter_move (__first));
6566 __d.template __incr <value_type>();
6667 ++__t ;
6768 _ForwardIterator __i = __first;
@@ -70,7 +71,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
7071 *__first = _Ops::__iter_move (__i);
7172 ++__first;
7273 } else {
73- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__i));
74+ std::__construct_at ( __t , _Ops::__iter_move (__i));
7475 __d.template __incr <value_type>();
7576 ++__t ;
7677 }
@@ -116,7 +117,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __stable_partition_impl(
116117}
117118
118119template <class _AlgPolicy , class _Predicate , class _ForwardIterator >
119- _LIBCPP_HIDE_FROM_ABI _ForwardIterator
120+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
120121__stable_partition_impl (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) {
121122 typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
122123 typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
@@ -145,7 +146,7 @@ __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Pred
145146}
146147
147148template <class _AlgPolicy , class _Predicate , class _BidirectionalIterator , class _Distance , class _Pair >
148- _BidirectionalIterator __stable_partition_impl (
149+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _BidirectionalIterator __stable_partition_impl (
149150 _BidirectionalIterator __first,
150151 _BidirectionalIterator __last,
151152 _Predicate __pred,
@@ -179,7 +180,7 @@ _BidirectionalIterator __stable_partition_impl(
179180 // Move the falses into the temporary buffer, and the trues to the front of the line
180181 // Update __first to always point to the end of the trues
181182 value_type* __t = __p.first ;
182- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__first));
183+ std::__construct_at ( __t , _Ops::__iter_move (__first));
183184 __d.template __incr <value_type>();
184185 ++__t ;
185186 _BidirectionalIterator __i = __first;
@@ -188,7 +189,7 @@ _BidirectionalIterator __stable_partition_impl(
188189 *__first = _Ops::__iter_move (__i);
189190 ++__first;
190191 } else {
191- :: new (( void *) __t ) value_type ( _Ops::__iter_move (__i));
192+ std::__construct_at ( __t , _Ops::__iter_move (__i));
192193 __d.template __incr <value_type>();
193194 ++__t ;
194195 }
@@ -247,7 +248,7 @@ _BidirectionalIterator __stable_partition_impl(
247248}
248249
249250template <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 (
251252 _BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, bidirectional_iterator_tag) {
252253 typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
253254 typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
@@ -283,14 +284,14 @@ _LIBCPP_HIDE_FROM_ABI _BidirectionalIterator __stable_partition_impl(
283284}
284285
285286template <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 (
287288 _ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred, _IterCategory __iter_category) {
288289 return std::__stable_partition_impl<_AlgPolicy, __remove_cvref_t <_Predicate>&>(
289290 std::move (__first), std::move (__last), __pred, __iter_category);
290291}
291292
292293template <class _ForwardIterator , class _Predicate >
293- inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
294+ _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
294295stable_partition (_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
295296 using _IterCategory = typename iterator_traits<_ForwardIterator>::iterator_category;
296297 return std::__stable_partition<_ClassicAlgPolicy, _Predicate&>(
0 commit comments