Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-08-18 09:12:16


From: David Abrahams <dave_at_[hidden]>
> Rob Stewart <stewart_at_[hidden]> 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_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk