Comparison operators don't make much sense in fold-expressions; they expand into expressions that have surprising effects, and are thus useful for dsl-metaprogrammers only. This paper proposes removing comparison operators from the set of fold-operators.
It would be nice to be able to fix expressions like
a < b < c. That would require a time machine. Not repeating the problem for
fold-expressions seems doable.
The solution options I enumerated on the reflector were as follows:
== != < > <= >=from the list of supported fold-operators
Based on the reflector discussion, the last option might be tricky to specify, and might have surprising semantics. Some find having different semantics for it and the bare chain of multiple comparison operators potentially confusing. The safe choice is the second one.
There's no sane way to write a fold-expression using a comparison operator correctly. The way it works is not useful for non-expert programmers and is a source of surprise (based on real field experience). It's at best only a dsl-metaprogramming tool.
In [expr.prim.fold]/1, edit as follows:
fold-operator: one of
+ - * / % ˆ & | << >>
+= -= *= /= %= ˆ= &= |= <<= >>= =
== != < > <= >=&& || , .* ->*