function type parameter inference not working
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 23 12:40:39 PDT 2017
On 04/23/2017 09:33 PM, XavierAP wrote:
> 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
Please post self-contained code. When I fill the gaps you left, it works
for me:
----
struct Matrix(uint a, uint b) {}
struct Vector(uint a) {}
void assembleMass1D(Mat, Vec)(ref Mat M, const ref Vec x)
{ /* ... */ }
void main()
{
Matrix!(2,2) M;
Vector!2 V;
assembleMass1D(M, V); /* no error */
}
----
More information about the Digitalmars-d-learn
mailing list