As I was looking at this the implications were huge. We have this code base that contains these classes like Vector2D, Vector3D, Box1D, Box2D, Stats1D, Stats3D, etc. Not a very good match for something like SpatialIndexD<4>
I was thinking then about std::array
So everyone knows about C++ operator overloading. ++, /, *, +=, etc. These all work fine for what they do.
Looking at something like Vector2D/Vector3D I see operations like "dot" and "cross" and "wedge". Still operators but they just don't have a "blessed" symbol associated with them.
So of course I write a test program
double operator dot(double const & lhs, double const & rhs) { return lhs * rhs; }
int main()
{
std::cout << (5. dot 6.) << std::endl;
return 0;
}
And of course....no compilation.
No comments:
Post a Comment