Craig Black wrote:
In C++ I could to the following:
Vector3 cross(const Vector3 &a, const Vector3 &b) { ... }
and then call it like this:
Vector3 a, b, c;
a = cross(b, c);
a = cross(b-a, c-a);
But in D I have to define two functions if I want pass by reference to
work:
Vector3 cross(ref const Vector3 a, ref const Vector3 b) {...}
Vector3 cross(Vector3 a, Vector3 b) {...}
Isn't const for that (without ref)?
Vector3 cross(const Vector3 a, const Vector3 b) {...}
In this case, compiler should pass const by reference (since it will not
change).