[libc++][ranges] Implement ranges::min_element
Implement ranges::min_element
Reviewed By: Quuxplusone, Mordante, #libc
Spies: miscco, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D117025
NOKEYCHECK=True
GitOrigin-RevId: 3b470d1ce992407df81662c04cf0137850338af6
diff --git a/include/algorithm b/include/algorithm
index be10e30..b35ad67 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -31,8 +31,13 @@
template <class I, class O1, class O2>
struct in_out_out_result; // since C++20
- template<class I, class O>
- struct in_out_result; // since C++20
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
+ indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
+ constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
+
+ template<forward_range R, class Proj = identity,
+ indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
+ constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
}
template <class InputIterator, class Predicate>
@@ -749,6 +754,7 @@
#include <__algorithm/pop_heap.h>
#include <__algorithm/prev_permutation.h>
#include <__algorithm/push_heap.h>
+#include <__algorithm/ranges_min_element.h>
#include <__algorithm/ranges_swap_ranges.h>
#include <__algorithm/remove.h>
#include <__algorithm/remove_copy.h>