Issue 126660
Summary [libc++] Should we remove constraints on `flat_(multi)map`'s iterator's `operator<=>`?
Labels libc++
Assignees
Reporter frederick-vs-ja
    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
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to