But actually, I do not want to write own vector classes which derive from sf::Vector2i... I mean the sf::Vector is okay, I just need to overload operator <.
And about modding SFML: My intention is not to change the code in the SFML source or header files; if I needed something in namespace sf, I would write it in my own project (inside a local namespace sf block).
It should work without putting the operator in sf namespace. What exactly are the "many errors" ?
I get errors because std::map is trying to use std::operator < instead of my version:
1>c:\program files\microsoft visual studio 9.0\vc\include\functional(143) : error C2784: "bool std::operator <(const std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem *)": template-Argument für "const std::basic_string<_Elem,_Traits,_Alloc> &" konnte nicht von "const sf::Vector2i" hergeleitet werden.
1> c:\program files\microsoft visual studio 9.0\vc\include\string(150): Siehe Deklaration von 'std::operator <'
1> c:\program files\microsoft visual studio 9.0\vc\include\functional(142): Bei der Kompilierung der Klassen-template der bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const-Memberfunktion
1> with
1> [
1> _Ty=sf::Vector2i
1> ]
Plus, you don't really need to define a < operator, you can instead provide a functor as an extra parameter of your std::map. In this case I think it would be more appropriate, as your definition of operator < for vectors is not obvious (actually, vectors are not comparable in pure maths). It's just something that works.
I thought about creating an own functor, too, but if there is already the std::less criterion which has the same function, why shouldn't I use it and create an overloaded operator?
But yes, you're right, comparing too vectors doesn't make too much sense. In don't really need to compare them except for the automatic sort inside std::map.