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

Hristo Hristov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 5 08:37:08 PDT 2023


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

@philnik  Thank you for the review!

NOTE: Changes to `compare.pass.cpp` were too large so git failed to match it to `compare.verify.cpp`.



================
Comment at: libcxx/docs/Status/Cxx20.rst:65
+
+   .. [#note-LWG3347] LWG3347: Implemented changes in [array.syn] and [array.overview]
----------------
philnik wrote:
> Would you be interested in implementing the rest of this issue? It doesn't look too complicated.
Yes, let me do it in a follow up patch.


================
Comment at: libcxx/include/array:410-415
 template <class _Tp, size_t _Size>
 inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR_SINCE_CXX20 bool
-operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+bool operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
 {
     return !(__x == __y);
 }
----------------
philnik wrote:
> Let's try to not reintroduce wrong formatting.
I replaced _LIBCPP_INLINE_VISIBILITY and applied format to the whole section.


================
Comment at: libcxx/test/std/containers/sequences/array/compare.three_way.pass.cpp:74-76
+  // Thanks to SFINAE, the following is not a compiler error but returns `false`
+  struct NonComparable {};
+  static_assert(!std::three_way_comparable<std::array<NonComparable, N>>);
----------------
philnik wrote:
> Let's move the SFINAE test to the top of the file.
Moved it. My original motivation was to keep the same stricture of the test as tests in:
libcxx/test/support/test_container_comparisons.h
where they use templates.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132265



More information about the libcxx-commits mailing list