[libcxx-commits] [PATCH] D146094: [libc++][spaceship] Implement `operator<=>` for `stack`
Hristo Hristov via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 3 10:48:06 PDT 2023
H-G-Hristov added a comment.
@Mordante Thank you for the review.
A side question: In case we agree on the current implementation, shall I disable the `vector` test case and land this if the vector patch is not yet ready and reenable it later? Or should I wait for `vector` to land.
================
Comment at: libcxx/include/stack:357
+operator<=>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ return __x.__get_container() <=> __y.__get_container();
+}
----------------
Mordante wrote:
> If possible we prefer to do exactly what the Standard says. This is consistent with `operator==` and `operator<`.
`c` is a protected member of `stack`, which requires to declare the `operator<=>` as a friend similar to `operator==` and `operator<`. Such implementation compiles fine with Apple Clang 14.0.3 (LLVM 15) but it fails to compile on the CI with newer Clang 16/17 (I think) with myriad of `ambiguous operator declarations` errors all over the place. I did some research but all of this was over my head, so I settled on the above implementation.
I did the same for `queue`. I'll refrain to land these patches until I get more feedback.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146094/new/
https://reviews.llvm.org/D146094
More information about the libcxx-commits
mailing list