Passing rvalues to functions expecting const ref
Minas Mina
minas_mina1990 at hotmail.co.uk
Sun Dec 23 10:34:01 PST 2012
There's another problem though:
struct Vector3
{
float x, y, z;
this(float _x, float _y, float _z)
{
x = _x;
y = _y;
z = _z;
}
// the binary +, - operators are defined
}
Vector3 cross(const ref Vector3 a, const ref Vector3 b);
...
Vector3 n = cross(b-a, c-a);
raytracing/triangle.d(58): Error: function
raytracing.vector.cross (ref const(Vector3) a, ref const(Vector3)
b) is not callable using argument types (Vector3,Vector3)
raytracing/triangle.d(58): Error: this.b.opBinary(this.a) is not
an lvalue
raytracing/triangle.d(58): Error: this.c.opBinary(this.a) is not
an lvalue
That's what I actually want.
More information about the Digitalmars-d-learn
mailing list