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

Hristo Hristov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 30 01:42:16 PDT 2023


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


================
Comment at: libcxx/include/__algorithm/lexicographical_compare_three_way.h:106
     // Unoptimized implementation which compares the iterators against the end in every loop iteration
+    __three_way_comp_ref_type<_Cmp> __wrapped_comp_ref(__comp);
     return std::__lexicographical_compare_three_way_slow_path(
----------------
avogelsgesang wrote:
> I fear the actual issue is that `__three_way_comp_ref_type is currently buggy, and this change here only masks the issue.
> 
> I think the changes
> 
> ```
>    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) {
> ```
> 
> and
> 
> ```
>  // Pass the comparator by lvalue reference. Or in debug mode, using a
>  // debugging wrapper that stores a reference.
> -#  ifndef _LIBCPP_ENABLE_DEBUG_MODE
> +#  ifdef _LIBCPP_ENABLE_DEBUG_MODE
> ```
> 
> are required. Not sure if sufficient, though
I think it's good now. Thank you for the review/tip. I don't understand what's going on with the CI at the moment but build the local build of the latest revision is fine.


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