> why typedef std::result_of<f(int)>::type A; does not compile?
f is not a type (it is a function).
> Why is decltype and the reference & needed?
decltype is needed because decltype(f) is a type - int(int)
reference - either std::result_of< decltype( (f) )(int) >::type
or std::result_of< decltype(f)&(int) >::type - is needed because we can't return a function by value.
Functions are not copyable or moveable types.
We can return a reference (or a pointer) to a function.
decltype((f))(int) - type is function returning reference to function; same as decltype(f)&(int). decltype(&f)(int) - type is function returning pointer to function; same as decltype(f)*(int).