On 3/3/2011 12:13 AM, Michel MORIN wrote:
Thorsten Ottosen wrote:
These issues, including OP's one, can be fixed by removing unary function call operator of class boost::void_ptr_indirect_fun (i.e. making it BinaryFunction).
The problem then is that we can't use the class with unary functions. Something that might already we be done by users.
So, how about adding void_ptr_indirect_binary_fun (and void_ptr_indirect_unary_fun)? Then we have void_ptr_indirect_fun (with unary and binary function call operators) void_ptr_indirect_unary_fun (with unary function call operator) void_ptr_indirect_biary_fun (with binary function call operator) and use void_ptr_indirect_binary_fun when wrapping comparators.
I was messing around with enable_if to see if we could detect the number of arguments. But I couldn't find a traits that does that yesterday ... now I see <boost/function_types/function_arity.hpp> could help. This way I think we can avoid instantiating result_of until it works. If only we had perfect forwarding and variadic templates, it would be so easy to write operator()(). -Thorsten