[PATCH] D28371: Add missing operators for iterator_facade_base
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 6 10:17:57 PST 2017
chandlerc added inline comments.
================
Comment at: llvm/include/llvm/ADT/iterator.h:117-123
+ bool operator<(const DerivedT &RHS) const {
+ static_assert(
+ IsRandomAccess,
+ "Relational operators are only defined for random access iterators.");
+ return !static_cast<const DerivedT *>(this)->operator>(RHS) &&
+ !static_cast<const DerivedT *>(this)->operator==(RHS);
+ }
----------------
I don't get it...
This recurses through operator>, which recurses through operator<...
The derived class has to define one relational operator. Why can't we insist that it is always operator<? If it is, then the code you've added becomes dead...
https://reviews.llvm.org/D28371
More information about the llvm-commits
mailing list