On 4/11/18 10:26 AM, ixid wrote:
Is it possible to infer a template's return type from what it's assigned to? If not is this a difficult or worthless feature to add?

OUT fun(IN, OUT)(IN value) {
     return value.to!OUT;
}

void main() {
     float a = 5.0;
     int b = fun(a);
}

Sort of:

void fun(IN, OUT)(IN value, out OUT result)
{
   result = value.to!OUT;
}

Other than that, it doesn't work.

-Steve

Reply via email to