std::result_of can be used to determine the result of invoking a functor, in particular if the result type is different for different sets of arguments: