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

Tim Song via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 3 17:25:30 PDT 2021


tcanens 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>);
----------------
zoecarver wrote:
> 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.
//`not-same-as`// has been editorially renamed to //`different-from`//: [[ https://github.com/cplusplus/draft/commit/caf7428fd6c807f30538042cf9bf1b27b8772b01 ]]


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