Peter Dimov wrote:
David Morrison wrote:
Peter Dimov wrote:
Change this to boost::mem_fn( f )( a1, a2, a3 ) and you'll be there.
Yep, that's much cleaner, thanks.
I was hoping that there'd be some clever way to use type_traits to magically select the right way of invoking the function f. That way, one could have a (possibly enhanced version of?) apply.hpp so that code to invoke apply on a set of member and non-member functions would look the same.
On a reasonably conforming compiler, adding an overload to apply<> should work:
template
result_type operator() (F & f, A1 & a1, A2 & a2, A3 & a3) const { return f(a1, a2, a3); } // add this
template
result_type operator() (M T::* pm, A1 & a1, A2 & a2, A3 & a3) const { return mem_fn(pm)(a1, a2, a3); } It might be a good idea to add this to apply.hpp, but I would need to write a test for apply<> first. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- David Morrison Brookhaven National Laboratory phone: 631-344-5840 Physics Department, Bldg 510 C fax: 631-344-3253 Upton, NY 11973-5000 email: dave@bnl.gov