
Boost : 
From: Rob Stewart (stewart_at_[hidden])
Date: 20050801 15:38:51
What does the following expression mean?
all_of(x) != any_of(y)
1) It could mean that each of the values in x must not be equal
to any one of the values in y.
OTOH, should that expression be symmetrical?
any_of(y) != all_of(x)
2) When expressed that way, it suggests that as long as any of
the values in y is not equal to all of the values in x, the
result is true.
That is, given the following sets of values
s1 = { 1, 2, 3 }
s2 = { 3, 4, 5 }
what should be the value of this expression?
all_of(s1) != any_of(s2)
Intuitively, that seems to suggest 1), which means it evaluates
to false.
When reversed
any_of(s2) != all_of(s1)
the expression seems to suggest 2), which means it evaluates to
true.
I don't like the idea of these expressions being asymmetrical.
Perhaps we need each_of to mean each value should be compared
against the other side and, provided all of those comparisons
succeed, the expression evaluates to true.
Then, all_of can mean that all of the values must satisfy the
*same* comparison. Put another way, all_of(x) op any_of(y) must
be implemented by iterating y and comparing against all_of(x).
With those two types, and given s1 and s2 from above, we'd have
the following expressions evaluate to true:
all_of(s1) != any_of(s2)
!(each_of(s1) != any_of(s2))
 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