[libcxx-commits] [PATCH] D116268: [libc++][ranges] Add indirectly_comparable concept

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 28 10:41:04 PST 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/iterators/iterator.requirements/indirectcallable/indirectinvocable/indirectly_comparable.compile.pass.cpp:21
+};
+
+static_assert( std::indirectly_comparable<int*, int*, std::less<int>>);
----------------
Mordante wrote:
> Is there a reason not to include `static_assert(!std::indirectly_comparable<int, int, std::less<int>>);  // not dereferenceable`?
> I would like to see the suggested comment copied.
+1, also the one before it:
```
static_assert(!std::indirectly_comparable<int, int, std::less<int>>);  // not dereferenceable
static_assert(!std::indirectly_comparable<int*, int*, int>);  // not a predicate
```
FYI I'm not married to those specific code comments. I put them because I thought otherwise it was a little subtle (particularly because these are the first couple of lines, where the reader is still getting a handle on what we're doing here). After the first two lines, the "not a..." explanations get really complicated to explain, //plus// the reader should have gained a little experience decoding the earlier lines, so I figured comments were more pain than gain at that point.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116268



More information about the libcxx-commits mailing list