Implements parts of P1614R2 operator<=> for queue
Details
- Reviewers
Mordante - Group Reviewers
Restricted Project - Commits
- rG172d990c0394: [libc++][spaceship] Implement `operator<=>` for `queue`
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
libcxx/test/std/containers/container.adaptors/queue/compare.three_way.pass.cpp | ||
---|---|---|
25 ↗ | (On Diff #505155) | We should also test with a custom container to make sure it actually calls operator<=> and not std::lexicographical_compare_three_way(x.begin(), x.end(), y.begin(), y.end()). |
Can you fix the CI and address the open review comments, I prefer to review with the CI results.
libcxx/test/std/containers/container.adaptors/queue/compare.three_way.pass.cpp | ||
---|---|---|
25 ↗ | (On Diff #505155) | I added a "custom container" test I hope that it is custom enough. |
In general I'm happy, but I would like to see whether custom_container_iterator can be removed.
libcxx/test/support/test_container_comparisons.h | ||
---|---|---|
20 | Would it be possible to use nasty_vector from "nasty_containers.h" instead? You will need to add #if TEST_STD_VER >= 20 template <class T> auto operator<=>(const nasty_vector<T>& x, const nasty_vector<T>& y) { return x.v_ <=> y.v_; } #endif but that seems easier than to add a new class. |
libcxx/test/support/test_container_comparisons.h | ||
---|---|---|
20 | Cool! I looked for off-the-shelf containers but couldn't find them. |
It seems this solution fails in Clang 16 and works in Clang 15 and Clang 17. Please leave a comment in the body of the operator<=> to explain why you use the current approach.