Got rid of redundancy, might not be the most technical solution but:
boost::function<double (const double)> bindCPricer(OptionPricer &pricer) { return boost::bind(&OptionPricer::CallPrice, &pricer, _1); } boost::function<double (const double)> bindPPricer(OptionPricer &pricer) { return boost::bind(&OptionPricer::PutPrice, &pricer, _1); } cout << "Mesh1 Call: " << pricer1.Mesher(start, end, h, bindCPricer(pricer1)) << " Mesh1 Put: " << pricer1.Mesher(start, end, h, bindPPricer(pricer1)) << endl; cout << "Mesh2 Call: " << pricer2.Mesher(start, end, h, bindCPricer(pricer2)) << " Mesh2 Put: " << pricer2.Mesher(start, end, h, bindPPricer(pricer2)) << endl; Thank you very much for your input!
Btw. I have been programming Java for more than 10 years, I am wondering why I haven not learnt C++ earlier, so far it looks much more powerful to me, boost is awesome, templating is also more sophisticated than Java Generics.