aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm/stable_partition.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/__algorithm/stable_partition.h')
-rw-r--r--libcxx/include/__algorithm/stable_partition.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/libcxx/include/__algorithm/stable_partition.h b/libcxx/include/__algorithm/stable_partition.h
index e5ad48b2ed51..a49de6dbb0ef 100644
--- a/libcxx/include/__algorithm/stable_partition.h
+++ b/libcxx/include/__algorithm/stable_partition.h
@@ -15,7 +15,12 @@
#include <__iterator/advance.h>
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
-#include <memory>
+#include <__memory/destruct_n.h>
+#include <__memory/temporary_buffer.h>
+#include <__memory/unique_ptr.h>
+#include <__utility/move.h>
+#include <__utility/pair.h>
+#include <new>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -25,7 +30,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Distance, class _Pair>
-_ForwardIterator
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator
__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
_Distance __len, _Pair __p, forward_iterator_tag __fit)
{
@@ -108,13 +113,13 @@ __stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Pred
__second_half_done:
// TTTFFFFFTTTTTFFFFF
// f ff m sf l
- return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false, __fit);
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
// TTTTTTTTFFFFFFFFFF
// |
}
template <class _AlgPolicy, class _Predicate, class _ForwardIterator>
-_ForwardIterator
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator
__stable_partition_impl(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
forward_iterator_tag)
{
@@ -253,13 +258,13 @@ __first_half_done:
__second_half_done:
// TTTFFFFFTTTTTFFFFF
// f ff m sf l
- return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false, __bit);
+ return std::__rotate<_AlgPolicy>(__first_false, __m, __second_false).first;
// TTTTTTTTFFFFFFFFFF
// |
}
template <class _AlgPolicy, class _Predicate, class _BidirectionalIterator>
-_BidirectionalIterator
+_LIBCPP_HIDE_FROM_ABI _BidirectionalIterator
__stable_partition_impl(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
bidirectional_iterator_tag)
{
@@ -305,7 +310,7 @@ template <class _AlgPolicy, class _Predicate, class _ForwardIterator, class _Ite
_LIBCPP_HIDE_FROM_ABI
_ForwardIterator __stable_partition(
_ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred, _IterCategory __iter_category) {
- return std::__stable_partition_impl<_AlgPolicy, __uncvref_t<_Predicate>&>(
+ return std::__stable_partition_impl<_AlgPolicy, __remove_cvref_t<_Predicate>&>(
std::move(__first), std::move(__last), __pred, __iter_category);
}