
From: Liu Jin <cpp@vip.163.com>
"David" == David Abrahams <dave@boost-consulting.com> writes: > Anyway, saying that symmetry requires > none_of(a) == any_of(b) > to be equivalent to > any_of(a) == none_of(b) > is about as valid as saying > 3*x == 1+y > must be equivalent to > 1+x == 3*y > It makes no sense to me.
But it does break symmetry when none_of(a) == any_of(b) [no x in a equals to any y in b] is different from any_of(b) == none_of(a) [some x in b equals to nothing in a]
According to English rules, they are sensibly asymmetrical. Dave suggested previously that we should use that as our guide and it does make sense. Otherwise, one winds up forcing oneself to process special cases. (If none with any, put the any first (or second, whichever might be selected) to get the meaning correct.) To clarify: if (none_of(a) == any_of(b)) ... "if none of the values in a is equal to any value in b" if (any_of(b) == none_of(a)) ... "if any value in b is equal to none of the values in a" Whether written with the *_of() notation or in their English equivalents, these sound asymmetrical. In my implementation, none_of first leads to a different loop than any_of first. Thus, to force symmetry, one must play games with detecting the combinations to decide when to swap arguments. Allowing the asymmetry is straightforward, at least for my implementation. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;