Is it possible to write something similar to mem_fun and bind1st etc. so that STL algorithms such as for_each can be applied to more than one arguments? Of course, all except one arguments are given, and the one that has not is going to be filled in by the container elements.
Can anyone please give such an example?
What you are looking for is std::bind or its twin boost::bind. They are used like this:
Also have a look at as many broken ways to iterate as possible https://stackoverflow.com/a/8378613/105672