Re: any_of, all_of, none_of
On 2011-09-01 08:32, Gene Bushuyev wrote:
On Aug 23, 6:49 pm, "gast...@hotmail.com"<gast...@hotmail.com> wrote:
Hello all,
I was wondering why the c++ committee didn't decide to stick to the
'_if' convention as used in other STL algorithm, like all/all_if,
any / any_if etc.
It depends on personal preferences and perhaps the area of expertise.
All those mentioned algorithms were known under the name of "reduce"
functions since the dawn of hardware design languages. So I would
prefer them to be called the same way: or_reduce, and and_reduce. But
the real question, where is the equivalent of xor_reduce? And if they
do decide to add it, I can't find any descriptive name consistent with
this naming convention.
The names were chosen based on the nomenclature used in Stepanov' book
"Elements of Programming", as explained in the proposal document:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2666.pdf
They idea was to mirror the logical quantifiers ??? and ???. The actually
redundant form ??? was also added because it is often used (Note that the
same proposal also added the equally redundant find_if_not). I would
have found it more consistent, if the forth form not_all_of (which is
also redundant) would have been added as well. Interesting, I couldn't
find the corresponding Unicode symbol for it.
I'm not aware of any popular quantifier name that would have the effect
of xor_reduce.
HTH & Greetings from Bremen,
Daniel Kr??gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]