"cannot deduce function from argument types" issue.

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 10 01:08:46 PST 2015


Ali Çehreli:

> If think it is a little too much to ask from the template 
> system of D.

I remember hitting a similar problem with code like this bar() 
function:


// OK
void foo(size_t N1, size_t N2)(int[N1] a, int[N2] b)
if (N2 == N1 ^^ 2) {}

// Not OK
void bar(size_t N)(int[N] a, int[N ^ 2] b) {}

void main() {
     int[2] a = [1, 2];
     int[4] b = [1, 2, 3, 4];
     foo(a, b);
     bar(a, b);
}


So perhaps my suggestion to file an enhancement request is not a 
good idea...

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list