[libcxx-commits] [PATCH] D131372: Implement std::variant::operator<=>

Adrian Vogelsgesang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 7 17:55:55 PDT 2022


avogelsgesang added a comment.

Please also update `SpaceshipProjects.csv`



================
Comment at: libcxx/include/variant:1652-1653
+  if (auto __c = __lhs.index() <=> __rhs.index(); __c != 0) return __c;
+  auto __three_way = []<class _Type>(const _Type& __v, const _Type& __w) -> common_comparison_category_t<
+                                                                             compare_three_way_result_t<_Types>...> {
+    return __v <=> __w;
----------------
indentation here seems off
Also, it might help readability if we use an additional `using` type alias:

```
using _ResultType = common_comparison_category_t<compare_three_way_result_t<_Types>...>;
auto __three_way = []<class _Type>(const _Type& __v, const _Type& __w) -> ResultType {
      return __v <=> __w;
};
```



================
Comment at: libcxx/test/std/utilities/variant/variant.relops/three_way.pass.cpp:55
+template <class Var, class Order>
+constexpr bool test_three_way_val(const Var &l, const Var &r, Order order) {
+  static_assert(std::is_same_v<decltype(l <=> r), Order>);
----------------
seems to be unused?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131372



More information about the libcxx-commits mailing list