aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/__algorithm')
-rw-r--r--libcxx/include/__algorithm/inplace_merge.h1
-rw-r--r--libcxx/include/__algorithm/iter_swap.h37
-rw-r--r--libcxx/include/__algorithm/move.h1
-rw-r--r--libcxx/include/__algorithm/next_permutation.h2
-rw-r--r--libcxx/include/__algorithm/nth_element.h2
-rw-r--r--libcxx/include/__algorithm/partial_sort.h2
-rw-r--r--libcxx/include/__algorithm/partition.h2
-rw-r--r--libcxx/include/__algorithm/pop_heap.h2
-rw-r--r--libcxx/include/__algorithm/prev_permutation.h2
-rw-r--r--libcxx/include/__algorithm/push_heap.h2
-rw-r--r--libcxx/include/__algorithm/remove.h4
-rw-r--r--libcxx/include/__algorithm/reverse.h2
-rw-r--r--libcxx/include/__algorithm/rotate.h4
-rw-r--r--libcxx/include/__algorithm/shift_right.h1
-rw-r--r--libcxx/include/__algorithm/shuffle.h2
-rw-r--r--libcxx/include/__algorithm/sift_down.h3
-rw-r--r--libcxx/include/__algorithm/sort.h1
-rw-r--r--libcxx/include/__algorithm/stable_partition.h1
-rw-r--r--libcxx/include/__algorithm/stable_sort.h1
-rw-r--r--libcxx/include/__algorithm/swap_ranges.h37
-rw-r--r--libcxx/include/__algorithm/unique.h2
21 files changed, 97 insertions, 14 deletions
diff --git a/libcxx/include/__algorithm/inplace_merge.h b/libcxx/include/__algorithm/inplace_merge.h
index 81db692..24ad363 100644
--- a/libcxx/include/__algorithm/inplace_merge.h
+++ b/libcxx/include/__algorithm/inplace_merge.h
@@ -17,6 +17,7 @@
#include <__algorithm/min.h>
#include <__algorithm/upper_bound.h>
#include <__iterator/iterator_traits.h>
+#include <__utility/swap.h>
#include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/iter_swap.h b/libcxx/include/__algorithm/iter_swap.h
new file mode 100644
index 0000000..b63bce6
--- /dev/null
+++ b/libcxx/include/__algorithm/iter_swap.h
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_ITER_SWAP_H
+#define _LIBCPP___ALGORITHM_ITER_SWAP_H
+
+#include <__config>
+#include <__utility/declval.h>
+#include <__utility/swap.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void iter_swap(_ForwardIterator1 __a,
+ _ForwardIterator2 __b)
+ // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
+ _NOEXCEPT_(_NOEXCEPT_(swap(*declval<_ForwardIterator1>(), *declval<_ForwardIterator2>()))) {
+ swap(*__a, *__b);
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___ALGORITHM_ITER_SWAP_H
diff --git a/libcxx/include/__algorithm/move.h b/libcxx/include/__algorithm/move.h
index 120f00f..f5fc748 100644
--- a/libcxx/include/__algorithm/move.h
+++ b/libcxx/include/__algorithm/move.h
@@ -11,6 +11,7 @@
#include <__config>
#include <__algorithm/unwrap_iter.h>
+#include <__utility/move.h>
#include <cstring>
#include <utility>
#include <type_traits>
diff --git a/libcxx/include/__algorithm/next_permutation.h b/libcxx/include/__algorithm/next_permutation.h
index 91eef92..a337e5e 100644
--- a/libcxx/include/__algorithm/next_permutation.h
+++ b/libcxx/include/__algorithm/next_permutation.h
@@ -14,7 +14,7 @@
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/reverse.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits> // swap
+#include <__utility/swap.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/nth_element.h b/libcxx/include/__algorithm/nth_element.h
index 622c669..67a03cf 100644
--- a/libcxx/include/__algorithm/nth_element.h
+++ b/libcxx/include/__algorithm/nth_element.h
@@ -14,7 +14,7 @@
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/sort.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits> // swap
+#include <__utility/swap.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/partial_sort.h b/libcxx/include/__algorithm/partial_sort.h
index 377f6d4..4f9872c 100644
--- a/libcxx/include/__algorithm/partial_sort.h
+++ b/libcxx/include/__algorithm/partial_sort.h
@@ -16,7 +16,7 @@
#include <__algorithm/sift_down.h>
#include <__algorithm/sort_heap.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits> // swap
+#include <__utility/swap.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/partition.h b/libcxx/include/__algorithm/partition.h
index 9b6f37c..c859eac 100644
--- a/libcxx/include/__algorithm/partition.h
+++ b/libcxx/include/__algorithm/partition.h
@@ -11,6 +11,8 @@
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__utility/swap.h>
+#include <utility> // pair
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/pop_heap.h b/libcxx/include/__algorithm/pop_heap.h
index 356a433..7ebbef25 100644
--- a/libcxx/include/__algorithm/pop_heap.h
+++ b/libcxx/include/__algorithm/pop_heap.h
@@ -14,7 +14,7 @@
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/sift_down.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits> // swap
+#include <__utility/swap.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/prev_permutation.h b/libcxx/include/__algorithm/prev_permutation.h
index 24945b2..d6daa73 100644
--- a/libcxx/include/__algorithm/prev_permutation.h
+++ b/libcxx/include/__algorithm/prev_permutation.h
@@ -14,7 +14,7 @@
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/reverse.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits> // swap
+#include <__utility/swap.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/push_heap.h b/libcxx/include/__algorithm/push_heap.h
index c2ce07d..82a7c12 100644
--- a/libcxx/include/__algorithm/push_heap.h
+++ b/libcxx/include/__algorithm/push_heap.h
@@ -13,7 +13,7 @@
#include <__algorithm/comp.h>
#include <__algorithm/comp_ref_type.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits> // swap
+#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/remove.h b/libcxx/include/__algorithm/remove.h
index f8a6f27..4717d7d 100644
--- a/libcxx/include/__algorithm/remove.h
+++ b/libcxx/include/__algorithm/remove.h
@@ -11,8 +11,8 @@
#include <__config>
#include <__algorithm/find.h>
-#include <utility>
-#include <type_traits>
+#include <__algorithm/find_if.h>
+#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/reverse.h b/libcxx/include/__algorithm/reverse.h
index 210a332..e538de1 100644
--- a/libcxx/include/__algorithm/reverse.h
+++ b/libcxx/include/__algorithm/reverse.h
@@ -10,8 +10,8 @@
#define _LIBCPP___ALGORITHM_REVERSE_H
#include <__config>
+#include <__algorithm/iter_swap.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/rotate.h b/libcxx/include/__algorithm/rotate.h
index 812e400..0c9ccd7 100644
--- a/libcxx/include/__algorithm/rotate.h
+++ b/libcxx/include/__algorithm/rotate.h
@@ -11,11 +11,13 @@
#include <__algorithm/move.h>
#include <__algorithm/move_backward.h>
+#include <__algorithm/swap_ranges.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__iterator/next.h>
#include <__iterator/prev.h>
-#include <type_traits>
+#include <__utility/swap.h>
+#include <iterator>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/shift_right.h b/libcxx/include/__algorithm/shift_right.h
index 983252d..5cb4195 100644
--- a/libcxx/include/__algorithm/shift_right.h
+++ b/libcxx/include/__algorithm/shift_right.h
@@ -12,6 +12,7 @@
#include <__config>
#include <__algorithm/move.h>
#include <__algorithm/move_backward.h>
+#include <__algorithm/swap_ranges.h>
#include <__iterator/iterator_traits.h>
#include <type_traits> // swap
diff --git a/libcxx/include/__algorithm/shuffle.h b/libcxx/include/__algorithm/shuffle.h
index 0b4d3d4..637fca5 100644
--- a/libcxx/include/__algorithm/shuffle.h
+++ b/libcxx/include/__algorithm/shuffle.h
@@ -12,9 +12,9 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__random/uniform_int_distribution.h>
+#include <__utility/swap.h>
#include <cstddef>
#include <cstdint>
-#include <type_traits> // swap
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/sift_down.h b/libcxx/include/__algorithm/sift_down.h
index ce38d7f..dd4b54e 100644
--- a/libcxx/include/__algorithm/sift_down.h
+++ b/libcxx/include/__algorithm/sift_down.h
@@ -11,8 +11,7 @@
#include <__config>
#include <__iterator/iterator_traits.h>
-#include <utility>
-#include <type_traits>
+#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index eb3a5de..39ec213 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -15,6 +15,7 @@
#include <__algorithm/min_element.h>
#include <__algorithm/partial_sort.h>
#include <__algorithm/unwrap_iter.h>
+#include <__utility/swap.h>
#include <memory>
#include <type_traits> // swap
diff --git a/libcxx/include/__algorithm/stable_partition.h b/libcxx/include/__algorithm/stable_partition.h
index 7ed8c1e..931335f 100644
--- a/libcxx/include/__algorithm/stable_partition.h
+++ b/libcxx/include/__algorithm/stable_partition.h
@@ -12,6 +12,7 @@
#include <__config>
#include <__algorithm/rotate.h>
#include <__iterator/iterator_traits.h>
+#include <__utility/swap.h>
#include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h
index e94a8e0..32b239a 100644
--- a/libcxx/include/__algorithm/stable_sort.h
+++ b/libcxx/include/__algorithm/stable_sort.h
@@ -15,6 +15,7 @@
#include <__algorithm/inplace_merge.h>
#include <__algorithm/sort.h>
#include <__iterator/iterator_traits.h>
+#include <__utility/swap.h>
#include <memory>
#include <type_traits> // swap
diff --git a/libcxx/include/__algorithm/swap_ranges.h b/libcxx/include/__algorithm/swap_ranges.h
new file mode 100644
index 0000000..3c72dbd
--- /dev/null
+++ b/libcxx/include/__algorithm/swap_ranges.h
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_SWAP_RANGES_H
+#define _LIBCPP___ALGORITHM_SWAP_RANGES_H
+
+#include <__config>
+#include <__utility/swap.h>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _ForwardIterator1, class _ForwardIterator2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator2
+swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) {
+ for (; __first1 != __last1; ++__first1, (void)++__first2)
+ swap(*__first1, *__first2);
+ return __first2;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___ALGORITHM_SWAP_RANGES_H
diff --git a/libcxx/include/__algorithm/unique.h b/libcxx/include/__algorithm/unique.h
index c4ac052..fb6251a 100644
--- a/libcxx/include/__algorithm/unique.h
+++ b/libcxx/include/__algorithm/unique.h
@@ -13,7 +13,7 @@
#include <__algorithm/comp.h>
#include <__algorithm/adjacent_find.h>
#include <__iterator/iterator_traits.h>
-#include <utility>
+#include <__utility/move.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)