I would like to pass the bind1st(mem_fun(&my_class::f), this) functor to for_each. Unfortunately it is very difficult to read so I would like to give it a more readible name like this:
(the type I am looking for) meaningful_name = bind1st(mem_fun(&my_class::f), this);
for_each(v.begin(), v.end(), meaningful_name);
Is there a simple way to deduce the type of the functor? (I know mem_fun saves us a lot of pain exactly for this reason.)
This depends on the argument and return types of my_class:f. If the function is
then you need
This kind of thing will be nicer with C++0x: