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

Adrian Vogelsgesang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 25 16:40:30 PDT 2023


avogelsgesang 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(
----------------
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


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