[libcxx-commits] [PATCH] D132268: [libc++][spaceship] Implement `operator<=>` for `vector`

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 4 15:49:50 PDT 2023


philnik added a comment.

Looks basically good, but I'd like to understand the `__debug_three_way_comp` change before approving.



================
Comment at: libcxx/include/__algorithm/three_way_comp_ref_type.h:31
   template <class _Tp, class _Up>
-  _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __x, _Up& __y) {
+  _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(const _Tp& __x, const _Up& __y) {
     auto __r = __comp_(__x, __y);
----------------
Why is this change needed?


================
Comment at: libcxx/test/std/containers/sequences/vector.bool/compare.three_way.pass.cpp:59
+    std::vector<bool> f2{false, false};
+    assert(testOrder(f1, f2, std::strong_ordering::less));
+  }
----------------
Maybe also test one empty and one with `{false}`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132268/new/

https://reviews.llvm.org/D132268



More information about the libcxx-commits mailing list