Don't overload
operator<, since it doesn't mathematically make sense for vectors.
You can write a functor. Here I just add the components, you can also check for x coordinates first and then y (lexicographically), for this
std::pair already provides what you want.
struct VectorComparator
{
bool operator() (sf::Vector2f lhs, sf::Vector2f rhs) const
{
return lhs.x + lhs.y < rhs.x + rhs.y;
}
}
The associative STL containers take a further template parameter that specify the ordering criterion.
std::map<sf::Vector2f, Value, VectorComparator> map;