On 3/21/21 11:48 PM, Gavin Lambert via Boost wrote:
On 22/03/2021 5:48 pm, Robert Ramey wrote:
I have a really dumb question about this. Consider the count_if example. I understand how example works. But I can't figure out where the parameter _1 gets filled in. So I think that the count_if example should be completed with a small bit of code which uses the newly count_if function.
The _1 parameter is filled in by std::count_if itself (in this case, using each element of the passed iterators). That's the point of a lambda, so I'm not quite sure what you're unclear on. This is not creating a "count_if" function, if that's what you thought; it is a complete example including both definition and usage.
Having said that, I do think the docs could benefit by having some "compare and contrast" examples -- i.e. showing how each of those examples would have been implemented using C++11 lambdas or std::bind instead (and thus demonstrate the syntactic benefits of the library).
OK - I see this now. I knew is something dumb. I haven't needed lambdas
much in the work I've done. I think the following as an example
#include
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost