On 4/21/20 5:24 PM, Jean-Louis Leroy wrote:

I would like to combine them all, e.g.:

     alias sst(T) = SS!T.f;
     int d = sst(42); // <=> SS!int.f(42)

But it fails like this:

    aliasstaticfunction.d(23): Error: template `aliasstaticfunction.sst` cannot deduce function from argument types `!()(int)`, candidates are:
     aliasstaticfunction.d(22):        `sst(T)`

Implicit *Function* Template Instantiation (IFTI) only works on functions, not types. You are asking the compiler to deduce the template parameter of the struct from its inner function being called.

This is similar to constructors on templated types. D just doesn't do that currently.

You need a forwarder.

-Steve
  • Function aliasing problem Jean-Louis Leroy via Digitalmars-d-learn
    • Re: Function aliasing pr... Steven Schveighoffer via Digitalmars-d-learn

Reply via email to