ReturnType

Get the type of the return value from a function, a pointer to function, a delegate, a struct with an opCall, a pointer to a struct with an opCall, or a class with an opCall. Please note that $(D_KEYWORD ref) is not part of a type, but the attribute of the function (see template functionAttributes).

To reduce template instantiations, consider instead using typeof(() { return func(args); } ()) if the argument types are known or static if (is(typeof(func) Ret == return)) if only that basic test is needed.
template ReturnType (
alias func
) if (
isCallable!func
) {}

Examples

int foo();
ReturnType!foo x;   // x is declared as int

Meta