Why D const is annoying

Mehrdad wfunction at hotmail.com
Sat Dec 10 02:34:27 PST 2011


... and another...

struct Matrix(T, size_t N = 1)
{ public auto mul(Matrix!(T, N) other) const { return this; } }

void main()
{
     Matrix!(int, 2) m;
     m.mul(m);
}

annoy.d(7): Error: function annoy.Matrix!(int,2).Matrix.mul 
(Matrix!(int,N) other) const is not callable using argument types 
(Matrix!(int,2))
annoy.d(7): Error: cannot implicitly convert expression (m) of type 
Matrix!(int,2) to Matrix!(int,N)


More information about the Digitalmars-d mailing list