Original Post
If I implement basic data structures like n dim vectors I need some operators too.
My problem is that if I assign the result to a variable, it needs to be copied then.
What can I do to avoid this?
I could write the following:
which is the best for performance, but is quiet complicated to use.
Operators are nice but they are not the best for speed.
Any idea on how to write nice and fast code?
I've another question:
how can I avoid multiple implementation of the same operator+ when I wanna have += operator too? Do I really need to write twice almost the same?
[edited by - xropi on October 25, 2002 10:16:44 AM]
inline
void Vec2D_ADD(Vec2D &dest, Vec2D &src1, Vec2D &src2) {
dest.x = src1.x + src2.x;
dest.y = src1.y + src2.y;
}