On Wednesday, 6 May 2020 at 08:04:16 UTC, Jacob Carlborg wrote:
On 2020-05-05 19:11, learner wrote:
On Tuesday, 5 May 2020 at 16:41:06 UTC, Adam D. Ruppe wrote:
typeof(return)
Thank you, that was indeed easy!
Is it possible to retrieve also the caller return type?
Something like:
Yes, kind of:
void foo(string caller = __FUNCTION__)()
{
import std.traits : ReturnType;
alias R = ReturnType!(mixin(caller));
static assert(is(R == int));
}
int bar()
{
foo();
return 0;
}
Awesome and beautiful, thank you!