[libcxx-commits] [libcxx] [libc++] Make sure `flat_set::key_compare` handle `boolean-testable` correctly (PR #132622)

Hewill Kang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 23 10:23:11 PDT 2025


https://github.com/hewillk created https://github.com/llvm/llvm-project/pull/132622

None

>From cc53c5452a926be9bcd99d142e0d6565d85230ba Mon Sep 17 00:00:00 2001
From: Hewill Kang <hewillk at gmail.com>
Date: Mon, 24 Mar 2025 01:22:21 +0800
Subject: [PATCH] Make sure compare handle boolean-testable correctly

---
 libcxx/include/__flat_set/flat_set.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__flat_set/flat_set.h b/libcxx/include/__flat_set/flat_set.h
index cc45db7565bd4..9074e9e9cf241 100644
--- a/libcxx/include/__flat_set/flat_set.h
+++ b/libcxx/include/__flat_set/flat_set.h
@@ -602,7 +602,7 @@ class flat_set {
 
 private:
   _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); };
     return ranges::adjacent_find(__key_container, __greater_or_equal_to) == ranges::end(__key_container);
   }
 



More information about the libcxx-commits mailing list