On 06/12/2015 04:25 PM, Yuxuan Shui wrote:
When there are multiple overloaded functions, whose return type will I
get when I use ReturnType? Is there a way I could choose a specific
function by its parameter types?

I am curious about the answer myself but there is the workaround of passing the overload through a lambda:

import std.traits;

int foo(long)
{
    return 0;
}

short foo(byte)
{
    return 0;
}

void main()
{
    static assert(is (ReturnType!(() => foo(long.init)) == int));
    static assert(is (ReturnType!(() => foo(byte.init)) == short));
}

Ali

Reply via email to