The documentation for boost range states that count_if can be expressed as count using a filtered adaptor and then goes on to say that no algorithm needs the _if suffix. I'm having trouble seeing how that is the case. Here is the relevant section from the latest (1.49 beta) documentation.

Range Adaptor alternative to count_if algorithm

boost::count_if( rng, pred );

can be expressed as

boost::count( rng | boost::adaptors::filtered(pred), out );

What this means is that no algorithm with the _if suffix is needed.


First of all, what is "out"? I think this is supposed to be "value" as count requires the value to compare against for the count. But, since it does require the value, this makes the function fundamentally different than count_if which will only count the values that match the predicate. As far as I can tell, this means that "count" will filter values both by the predicate and by the value.

What am I missing? How can count_if be properly expressed as count. To me it seems like it can't.

-- 
Bill