<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/126660>126660</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Should we remove constraints on `flat_(multi)map`'s iterator's `operator<=>`?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    Currently, `__key_value_iterator`'s `operator<=>` is constrained:
https://github.com/llvm/llvm-project/blob/ea6827cacfde062c7d9f03266af5298499313176/libcxx/include/__flat_map/key_value_iterator.h#L142-L146

which suggests that it's handling cases where the `__key_iterator` is not three way comparable.

However, per [[flat.map.overview]/7](https://eel.is/c++draft/flat.map.overview#7) & [[flat.multimap.overview]/7](https://eel.is/c++draft/flat.multimap.overview#7), the `__key_iterator` type must be a random access iterator. And per [[container.reqmts]/40](https://eel.is/c++draft/container.reqmts#40), such an iterator type should support three way comparision (since C++20).

---
Also, it seems that `MinSequenceContainer` should not use `random_access_iterator` which is random access but not three way comparable even since C++20.

https://github.com/llvm/llvm-project/blob/ea6827cacfde062c7d9f03266af5298499313176/libcxx/test/support/MinSequenceContainer.h#L17-L19

CC @huixie90
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8lM-OozgQxp-mcrGCTEFIOHBIpxftofc0DxDZpgieMZixTdJ5-5WB6T-TnZVGWu3JUaLU99Wvqj7hvb4MRBXsnmD3vBFT6KyrWkcNOa2-ba9--1VspG3u1WlyjoZg7oAnBgU_n7_R_XwVZqKzDuREsA4KDrj38Wc7rl9lJ8ieIfsDCs60Z8oOPjihB2ogOwI_diGMPn7EGrC-6NBNMlG2B6yNuf54tqOzX0kFwFoaKwFrEsUB90qotiFeoNo3ZcszLArR7rA85GWZpVm6L2IBLdXrK2CtB2WmhgDr87k1Ipx7MQLWj40kHWD2kua4fUnzAng0euu06pifLhfywbPQicB0mPvtxNAYPVyYEp48u3XkiIWO3jl9IBQpDDaw0DkidhN3pmw_CiekoWSR-tPe6Eoukh7JsXk6T9Fw0osxsVdyV0032D0D1vv5OXzGSGQS7QFrBfgE-NQ40UZ2jzUw2wOWDLD4JDOZoP8TrYdCi2Bs7ZeAwn0k1k8-MElMMCeGxvZMKEXes7cRsePQfMCj7BDiWrnE0fc--MVxzn_H8kMNzHK-uvWT6pgY3vQXl76zk2mYn8bRuseZaq_twAAPXg-K2GmRw1hzHfV2uwV-PBpvo4gOzBP163ZBwf_Swxf6PtGg6PTDXES06sY9mvyMcaF0Xih9wrksrvY_gZRT-OUeMrrSwH4yvTr-Pw82kI8VVryA9T_xWI91v31Jy8Xi6cQg592kXzWVfNNUWVNmpdhQle6zEvMci8Omq2SZKp63EoWUu6ZtcynKLJWNwN2haBVudIUcdxzTlGeY4yHhVOzyNs9kK5v2IHPIOfVCmyS2nFh32WjvJ6pSLIqCb4yQZPycroixqQUlIMa0ddUMSk4XDzk32gf_XifoYOZc_vC33TP7ssz9RsxRb6_0nqfBs7hqBZ-DDfAwnx5gGTNuzeW3rfiXkIas3kzOVL895rnzeFRr89cK_w4AAP__5jYKLg">