Better solution: http://www.boost.org/doc/libs/1_47_0/libs/function_types/doc/html/boost_functiontypes/reference/decomposition.html#boost_functiontypes.reference.decomposition.result_type