[D1] struct opEquals questions

qwerty qw at er.ty
Thu Mar 18 05:20:16 PDT 2010


In my unittest I tried to test out my rotate function.
assert(Vec2(1,2).rotate(90) == Vec(-2,1));
But I got these compile errors:
vector.d(156): Error: function vector.Vec.opEquals (Vec) does not match parameter types (void)
vector.d(156): Error: cannot implicitly convert expression (opCall(1,2).rotate(opCall(90))) of type void to Vec*

2 questions:
My opEquals takes an Vec2 and not a *Vec2, is this wrong?
Why is return value of the rotate function compared and not the rotated struct literal?


More information about the Digitalmars-d-learn mailing list