[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
Sat Mar 22 02:17:56 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:

Hmm, IIUC that both constraint and mandate are OK, while mandate can bring clearer error messages.
It's probably UB or IFNDR to use `flat_(multi)map` to adapt types not providing three-way comparable iterators.

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


More information about the libcxx-commits mailing list