[libcxx-commits] [PATCH] D92255: [libc++] [P0202] constexpr set_union, set_difference, set_symmetric_difference, merge

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 4 12:33:20 PST 2020


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/algorithms/alg.sorting/sortable_helpers.h:34
+    TEST_CONSTEXPR NonTrivialSortable& operator=(const NonTrivialSortable& rhs) { value = rhs.value; return *this; }
+    friend TEST_CONSTEXPR bool operator<(const NonTrivialSortable& a, const NonTrivialSortable& b) {
+        return a.value / 10 < b.value / 10;
----------------
zoecarver wrote:
> Super nit: I feel like it's a bit cleaner to say:
> ```
> TEST_CONSTEXPR bool operator<(NonTrivialSortable b) {
>   return value / 10 < b.value / 10;
> }
> ```
> 
> No friend; no reference. 
I like hidden-friend, though, so I won't change it. Let someone else do that later if they want to. ;)
(Hidden-friend is also a tiny bit harder to screw up by forgetting a `const`, IMVHO, because it treats both parameters the same.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92255



More information about the libcxx-commits mailing list