[libcxx-commits] [PATCH] D103493: [libcxx][ranges] Add concepts in range.utility.helpers.

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 1 16:01:19 PDT 2021


zoecarver added inline comments.


================
Comment at: libcxx/test/libcxx/ranges/range.utility.helpers/not_same.compile.pass.cpp:15-21
+static_assert(std::__not_same_as<int, char>);
+static_assert(std::__not_same_as<const int, char>);
+static_assert(!std::__not_same_as<const int, int>);
+static_assert(!std::__not_same_as<const volatile int, int>);
+static_assert(!std::__not_same_as<const int&, int>);
+static_assert(!std::__not_same_as<int&, int>);
+static_assert(!std::__not_same_as<int&&, int>);
----------------
Quuxplusone wrote:
> As I think @tcanens remarked a few days ago: WG21 has an exposition-only concept `not-same-as` that is not the same thing as `not same_as`? That's just awful.
> Due to its awfulness, I would suggest either giving this a scarier name, or dropping it altogether if humanly possible. (And/or filing a LWG issue, of course.)
> 
> If you keep this test, you should add
> ```
> static_assert(!std::__not_same_as<int, int&>);
> static_assert(!std::__not_same_as<int&, const int&>);
> static_assert(!std::__not_same_as<int(&)(), int()>);
> static_assert(std::__not_same_as<int(&)(), int(*)()>);
> ```
> i.e., test some things where the ref-qualification is on the right-hand operand; and test some things where `remove_cvref_t` is visibly different from `decay_t`.
I agree the name/concept is terrible. But it is widely used throughout the ranges library, so I think we're stuck with it for a little while. 

Additionally, I think it's imperative that we continue to name `exposition-only-concepts` in a mechanical way: `__exposition_only_concepts`. This way we can easily lookup concepts, verify correctness, and prevent duplication. 

I'll add those tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103493



More information about the libcxx-commits mailing list