[llvm] [NFC][ADT] Add range wrapper for std::maximal (PR #104838)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 12:27:00 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Rahul Joshi (jurahul)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/104838.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/STLExtras.h (+7)
``````````diff
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 249ac384bec41..61022cc5a2d28 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -2002,6 +2002,13 @@ template <typename R, typename Compare> auto max_element(R &&Range, Compare C) {
return std::max_element(adl_begin(Range), adl_end(Range), C);
}
+/// Provide wrappers to std::mismatch which take ranges instead of having to
+/// pass begin/end explicitly.
+template <typename R1, typename R2> auto mismatch(R1 &&Range1, R2 &&Range2) {
+ return std::mismatch(adl_begin(Range1), adl_end(Range1), adl_begin(Range2),
+ adl_end(Range2));
+}
+
template <typename R>
void stable_sort(R &&Range) {
std::stable_sort(adl_begin(Range), adl_end(Range));
``````````
</details>
https://github.com/llvm/llvm-project/pull/104838
More information about the llvm-commits
mailing list