function type parameter inference not working

XavierAP via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 23 12:33:48 PDT 2017


It's not working for my case, while I see no special reason why 
it couldn't. Also I can't find specific inference rules at 
http://dlang.org/spec/function.html#function-templates

Is it a problem that the types to be inferred are in turn also 
templated? Any workaround that can make inference work? Otherwise 
I would re-consider my design rather than having to specify types 
already available in the runtime arguments :(

void assembleMass1D(Mat, Vec)(ref Mat M, const ref Vec x)
{ /* ... */ }
Matrix!(2,2) M = /* ... */;
Vector!2     V = /* ... */;
assembleMass1D(M, V); // ERROR template cannot deduce function 
from argument types


More information about the Digitalmars-d-learn mailing list