(for simplicity I will only mention the getLength() function/method)
There is no reason not to integrate it.
There are many reasons, although they may be not obvious to the average user, who doesn't have to care about designing a consistent, well-thought API. If you take a look at the discussions at my link posted above, you'll find a lot of explanations.
I did not find a single argument. Only "Vector2<int> would be a problem".
Free functions CAN be in an API, but they should not if there is an alternative.
Why should they not?
Quoting myself:
Just do not pollute the sf namespace with specific functions for this and that. Classes are not only for combining variables into a single one.
Additionally (for example) Visual C++ lists all the methods when hitting . or -> which is not available for globals.
Generic algorithms like std::for_each have to be global, but a function for calculating a vector's length is not generic only because Vector2 is a template.
The decision between global and member functions doesn't primarily depend on the use of templates. Reusability is just one criterion (and can also be achieved by other abstraction features).
Are there any other criteria? In this case reusability does not matter anyway. The function would not be used for anything else that calculating that length.
[*]Global functions aren't limited to classes, they can be used for scalar types as well.
Does not matter, I only want to get a vector's length and nothing else[*]They can be overloaded for different object types.
Several classes can have a same-looking method as well[*]They take implicit object conversions into account.
I do not want anything to be converted into a vector implicitly[*]They increase encapsulation since they don't have direct access to all class members.
Vector2 has only public members, is not even close to an argument btw[*]They can be written as templates once and be reused for multiple classes.
Vector2 is already a template[*]They can interact with argument dependent lookup.
Methods behave similarly[*]They can be declared separate from the class definition.
Why should someone want that? Would be confusing to have vector functions in a different header than the vector itself[/list]
Now it's your turn to tell me when member functions are the better choice (as long as free functions are still an alternative, i.e. when neither virtual nor non-public member access is required). ;)
If you want to use globals a lot, I would recommend C.