Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
This is the answer of Exercise #9: No for-loops.
Replace the for-loop. You will need:
#include <vector> |
#include <algorithm> |
#include <algorithm> |
Note that you do not need boost::mem_fn, because it is added for you. If this is done by hand, like in the code below, the solution is still correct.
void DoItOften(const std::vector<Widget>& v, const int n) |
Note that _1 is a placeholder of type boost::arg<1> and can be found in boost/bind/placeholders.hpp.
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.