Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 31,447 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: any_of, all_of, none_of    |
|    03 Sep 11 11:18:53    |
      eacd0621       From: daniel.kruegler@googlemail.com              Am 01.09.2011 08:32, schrieb Gene Bushuyev:       [..]       > 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.              I find your explanation a bit misleading. The nearest counterpart to       "reduce" in the standard library is the function template accumulate       from Clause 26. This is also indicated by the footnote 288 in the FDIS       document:              "accumulate is similar to the APL reduction operator and Common Lisp       reduce function, but it avoids the difficulty of defining the result of       reduction on an empty sequence by always requiring an initial value."              If you replace the (default) operation + by && you have essentially       all_of. The reduction operator can be applied to a large number of       binary operations and accumulate is customized within this operation.       There is no need why all_of and the like should provide the same       customization point, they are purely (logic) quantifier functions.              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! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca