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

Hristo Hristov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 5 06:23:14 PDT 2023


H-G-Hristov marked 2 inline comments as done.
H-G-Hristov added a comment.

@philnik Thank you for the review!

In D132268#4320495 <https://reviews.llvm.org/D132268#4320495>, @philnik wrote:

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

This change was proposed by avogelsang above actually, as without it the tests of `vector<bool>` build fails with:

> lexicographical_compare_three_way.h:103:12: error: no matching function for call to '__lexicographical_compare_three_way_fast_path'
>
>   return std::__lexicographical_compare_three_way_fast_path(
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> vector:3296:17: note: in instantiation of function template specialization 'std::lexicographical_compare_three_way<std::__bit_iterator<std::vector<bool>, true, 0>, std::__bit_iterator<std::vector<bool>, true, 0>, std::strong_ordering (*)(const bool &, const bool &)>' requested here
>
>   return std::lexicographical_compare_three_way(



================
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);
----------------
philnik wrote:
> Why is this change needed?
Without it the build fails.


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