Operator Overloading and boilerplate code

Loopback elliott.darfink at gmail.com
Mon Jul 4 17:44:03 PDT 2011


I've researched a bit though I still haven't come up with a solution.
Since the problem lies within (the most simple) constructor, I tried to
modify it for another outcome. If I supplied a generic parameter to the
pre-constructor the "Cannot evaluate at compile time" message
disappeared but two new errors appeared instead.

This is what I modified:

this()(float x, float y, float z) => this(T)(float x, float y, float z)

If I use this code instead, I get two other errors appearing:

Error: template test.DVECTOR2.__ctor(T) does not match any function 
template declaration

This error and another one (individual to each statement) appears in the
following code statements:


Error: template test.DVECTOR2.__ctor(T) cannot deduce template function 
from argument types !()(float,float)
DVECTOR2 m_zoom = DVECTOR2(2f, 2f);

Error: template test.DVECTOR2.__ctor(T) cannot deduce template function 
from argument types !()(immutable(float),const(float))
immutable DVECTOR2 m_UP_DIR = DVECTOR2(0f, 1f, 0f);


More information about the Digitalmars-d-learn mailing list