[libcxx-commits] [libcxx] [libc++] Make `flat_(multi)map`'s iterators require `operator<=>` (PR #131290)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 28 07:19:52 PDT 2025


================
@@ -139,9 +141,12 @@ struct __key_value_iterator {
     return !(__x < __y);
   }
 
-  _LIBCPP_HIDE_FROM_ABI friend auto operator<=>(const __key_value_iterator& __x, const __key_value_iterator& __y)
-    requires three_way_comparable<__key_iterator>
-  {
+  _LIBCPP_HIDE_FROM_ABI friend strong_ordering
+  operator<=>(const __key_value_iterator& __x, const __key_value_iterator& __y) {
----------------
frederick-vs-ja wrote:

> I have not checked whether `flat_map` has other mandates that causes the code to be ill-formed anyway.

IIRC there's no such mandate in the standard wording.

Anyway, given https://github.com/llvm/llvm-project/pull/125241#discussion_r2008183972, I'll drop the change in product code and only make the tests use suitable containers with `flat_meow`.

https://github.com/llvm/llvm-project/pull/131290


More information about the libcxx-commits mailing list