
On Oct 4, 2011, at 3:42 PM, Andrew Hundt wrote:
What is the advantage of the functions in all.hpp over std::count?
I feel like one could simply call (in pseudocode) std::count == 0, std::count == 1, std::count == class.size() to achieve the same effect.
Clarity of naming, for one. if ( all_of ( sequence, predicate )) is a lot clearer than: if ( count_if ( sequence, value ) == sequence.count ()) Performance, for another: all_of ( sequence, predicate ) only examines members of the sequence until one fails. count_if ( sequence, value ) examines every element of the sequence. -- Marshall Marshall Clow Idio Software <mailto:mclow.lists@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki