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

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 31 12:55:54 PDT 2022


Mordante added a comment.

I have some issues regarding the difference of the paper and the Standard, can you look for an LWG-issue. I couldn't find one quickly. I glossed over the rest of the patch but didn't do a real review since it's uncertain what should be implemented.



================
Comment at: libcxx/include/array:91
+  constexpr synth-three-way-result<T>
+    operator<=>(const array<T, N>& x, const array<T, N>& y);    // since C++23
 
----------------
Did you look for any LWG issues in this header?

P1614 states 
```
[ Editor's note: array’s comparisons move to be hidden friends to allow for use as non-type template parameters. All the other containers drop != and, if they have relational operators, those get replaced with a <=>. ]
```
Change 22.3.2 [array.syn]:
The `operator==` has been removed from the header and `operator<=>` isn't added/

Change 22.3.7.1 [array.overview]:
```
+   friend constexpr bool operator==(const array&, const array&) = default;
+   friend constexpr synth-three-way-result<value_type>
+     operator<=>(const array&, const array&);
```

But this doesn't match the WP. No friends and no defaulted `operator==`.



================
Comment at: libcxx/include/array:443
+template <class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr __synth_three_way_result<_Tp>
----------------



================
Comment at: libcxx/include/array:447
+{
+    return _VSTD::lexicographical_compare_three_way(
+        __x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
----------------



================
Comment at: libcxx/test/std/containers/sequences/array/compare.pass.cpp:123
 #if TEST_STD_VER >= 20
-    static_assert(tests(), "");
+    static_assert(tests());
 #endif
----------------
nice!


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