
From: David Abrahams <dave@boost-consulting.com>
Rob Stewart <stewart@sig.com> writes:
if (any_of(...) << some_predicate() >> 5)... // 1
if (any_of(...) < some_predicate() > 5)... // 2
if (any_of(...) ^ some_predicate() ^ 5)... // 3
if (any_of(...) / some_predicate() / 5)... // 4
1 seems pretty good because the two-character operators stand out well. 2 works pretty well, but I'm concerned that the operators may get lost if the predicate is a specialization of a template type; the template argument list uses the same tokens. (1 is better in that case because of the doubled tokens.)
None of them look right to me. Unless you close up the spaces next to some_predicate(), they appear to be doing what the usual C++ operators do. a < b looks like less-than; a <b immediately starts to suggest something else.
You can omit spaces to make it look right to you. I dislike omitting spaces around operators. So, without the internal spaces, do you like any of them? if (any_of(...) <<some_predicate()>> 5)... // 1 if (any_of(...) <some_predicate()> 5)... // 2 if (any_of(...) ^some_predicate()^ 5)... // 3 if (any_of(...) /some_predicate()/ 5)... // 4 -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;