Boost logo

Boost :

From: Florian Stegner (FlSt_at_[hidden])
Date: 2005-08-09 00:34:59


Rob Stewart wrote:

>From: FlSt_at_[hidden]
>
>
>
>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.
>
Now I understand it. If you compare our implementations, this is exactly
what not_all_of in my implementation does.

>>>"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.
>
Yes your are right. It is the same like one_of where the result of the
predicate is negated. I wouldn't add too much xxx_of operators, because
the most expressions of them can be formulated with others.
one_of( a ) > x means the same as all_except_one( a ) <= x

Sincerly
  Florian


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