The correct overloads you want are:
Vector operator-(const Vector& v) const;
Vector operator-(Vector&& v) const;
Note that you want to mark the method themselfs as const
as well, because otherwise you will run into more problems when you have expressions like (pos-norm)-bias
(whether that example makes sense or not). In the long run, if you really want to exploit move semantics, you actually want to do more, as the left-hand side might also be movable and you want to complete the set of operators with -=
. In the end, you probably want two member functions:
Vector& operator-=(const Vector& v);
Vector& operator-=(Vector&& v);
and a set of four free functions:
Vector operator-(const Vector& lhs, const Vector& rhs);
Vector operator-(const Vector& lhs, Vector&& rhs);
Vector operator-(Vector&& lhs, const Vector& rhs);
Vector operator-(Vector&& lhs, Vector&& rhs);
The latter can be improved/optimized further by having it automatically generated for you, consider using a library like Boost.Operators or my df.operators to help you with that.
Generally, you might want to read the FAQ for operator overloading.