diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-18 20:30:12 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-19 21:12:03 +0000 |
| commit | c9157d925c489f07ba9c0b2ce47e5149b75969a5 (patch) | |
| tree | 08bc4a3d9cad3f9ebffa558ddf140b9d9257b219 /contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h | |
| parent | 2a66844f606a35d68ad8a8061f4bea204274b3bc (diff) | |
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h')
| -rw-r--r-- | contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h index 5cc418d3393c..782ce2670f05 100644 --- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h +++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_max.h @@ -56,7 +56,7 @@ struct __fn { operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element"); - auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; + auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { return std::invoke(__comp, __rhs, __lhs); }; return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp_lhs_rhs_swapped, __proj); } @@ -72,7 +72,9 @@ struct __fn { _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element"); if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) { - auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; + auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { + return std::invoke(__comp, __rhs, __lhs); + }; return *ranges::__min_element_impl(std::move(__first), std::move(__last), __comp_lhs_rhs_swapped, __proj); } else { range_value_t<_Rp> __result = *__first; |
