Alright so I made those functions... all you do is drop the functions in to the Vector2.hpp you have and your cool.
////////////////////////////////////////////////////////////
/// \relates Vector2
/// \brief Multiply 2 Vectors
///
/// \param left Left operand (a vector)
/// \param right Right operand (a vector)
///
/// \return (A Multiplied Vector)
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator *(const Vector2<T>& left, const Vector2<T>& right)
{
T X = left.x * right.x;
T Y = left.y * right.y;
return Vector2<T>(X,Y);
}
////////////////////////////////////////////////////////////
/// \relates Vector2
/// \brief Divide 2 Vectors
///
/// \param left Left operand (a vector)
/// \param right Right operand (a vector)
///
/// \return (A Divided Vector)
///
////////////////////////////////////////////////////////////
template <typename T>
Vector2<T> operator /(const Vector2<T>& left, const Vector2<T>& right)
{
T X = left.x / right.x;
T Y = left.y / right.y;
return Vector2<T>(X,Y);
}
An important rule for operator overloading is: Only do it when the semantics are clear. Multiplication and division of two vectors are not clear, since they are not mathematically defined. As eXpl0it3r mentioned, you can interpret * also as dot or even as cross product.
In Thor, I wrote named functions (http://www.bromeon.ch/libraries/thor/v2.0/doc/_vector_algebra2_d_8hpp.html) for the vector operations:
sf::Vector2f a, b;
sf::Vector2f c = thor::dotProduct(a, b);
sf::Vector3f d = thor::crossProduct(a, b);
sf::Vector2f e = thor::componentwiseProduct(a, b);
sf::Vector2f f = thor::componentwiseQuotient(a, b);
By the way, this reminds me of something I thought about long ago: The renaming of "componentwise" to "cwise"... Otherwise the latter two function calls are really long in expressions.