[libcxx-commits] [libcxx] [libc++] Make sure `flat_{multi}map::key_compare` handle `boolean-testable` correctly (PR #132621)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Mar 23 10:46:11 PDT 2025
================
@@ -846,7 +846,7 @@ class flat_map {
__compare_(std::forward<_CompArg>(__comp)...) {}
_LIBCPP_HIDE_FROM_ABI bool __is_sorted_and_unique(auto&& __key_container) const {
- auto __greater_or_equal_to = [this](const auto& __x, const auto& __y) { return !__compare_(__x, __y); };
+ auto __greater_or_equal_to = [this](const auto& __x, const auto& __y) -> bool { return !__compare_(__x, __y); };
----------------
frederick-vs-ja wrote:
I _think_ it's expected that `decltype(__compare_(__x, __y))` already model _`boolean-testable`_ (or even is exactly `bool` in most normal usages).
If the standard were already so requiring, we wouldn't need to change these lambdas. But I haven't found such a requirement...
https://github.com/llvm/llvm-project/pull/132621
More information about the libcxx-commits
mailing list