Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-08-08 14:39:52


From: FlSt_at_[hidden]
> Pavel Vozenilek wrote:
> >"Rob Stewart" wrote
> >
> >I didn't find time to study neither of the current
> >implementations (you both code faster than I can read ;-)
> >so I am bit confused by the difference between
> >"each" and "all".
> >
> When I wouln't know the implementation I would be also confused. each_of
> means the same like not_all_of in my implementation.

My suggestion for each_of was to handle the situation in which
each could match independently, whereas with all_of, each must
match the same other value. IOW, given ranges L and R,
each_of(L) == any_of(R) means that each value in L may match any
value in R, whereas all_of(L) == any_of(R) means each value in L
must match any single value in R. Thus, if L[n] == R[m] for any
n in L and m in R, each_of(L) == any_of(R) is true. However, for
all_of(L) == any_of(R), all values of L must equal R[m] for any m
in R.

Does that make sense?

> >"all_except_one" is quite common situation
> >which may be considered too.
> >
> This is also the same like not_all_of

No. "all_except_one," or maybe "all_but_one," means exactly
N - 1 matches, where N is the length of the range.

-- 
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