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

Adrian Vogelsgesang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 19 20:55:42 PST 2022


avogelsgesang added inline comments.


================
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
 
----------------
Mordante wrote:
> 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==`.
> 
https://cplusplus.github.io/LWG/issue3347 removed the `friend`s again and reintroduced the free-standing comparisons again


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