std::result_of . :
result_of<F(ArgTypes...)>
F - - invokable, - . -: &Foo<int>::func. --, , . decltype(&Foo<int>::func). - - .
, :
using T = std::result_of_t<decltype(&Foo<int>::func)(Foo<int>&)>;
static_assert(std::is_same<T, int&>::value, "!");
decltype:
using T = decltype(std::declval<Foo<int>&>().func());
.
bar, :
using T = decltype(bar.func());
:
using T = std::result_of_t<decltype(&decltype(bar)::func)(decltype(bar))>;