As fas as I understand, result_of_t should be a type, that will be at the end of the evaluation of an expression. decltype(&foo) in the code below yields the type int (*)(int), but what does (int) outside of decltype?
#include <type_traits>
int foo(int) {
return 0xdeadbeef;
}
int main()
{
using T = std::result_of_t<decltype(&foo)(int)>;
T t;
return 0;
}
It confuses us.
std::result_ofis defined in a "cute" way. It's specialized forF(Args...). WhereFis the functor type, whileArgs...are the arguments being fed to it.In your case,
(int)is the arguments to the call.This, and certain other quirks of the definition, is why
std::result_ofwas deprecated in C++17, and replaced withstd::invoke_result.