But what if I want to use an already existing vector?What would that change? Conversion constructors are there to construct from another, existing object...
Or, in a more specific instance, what if I want to take the vector2i coordinates given by sf::Mouse::getPosition() and store it in a vector2f?You don't.
What would that change? Conversion constructors are there to construct from another, existing object...
Mouse position coordinate are always integer, a mouse is on a pixel, but can't be between 2 pixels.
If you want to "convert" the mouse position to a world position, you might want to use mapPixelToCoords anyway and it returns an sf::Vector2f.
why CAN'T I just do vector2i = vector2f or vice versa?Because implicit conversions decrease type safety.
And why does getPosition() return a vector2i instead of a vector2f?The coordinates are in pixels, which are integral.
I'm saying both objects already exist. The constructor would only be useful if I was creating the vector2f right when I'm trying to store the coordinates from getPosition(), which I'm not.You can use the assignment operator to assign a newly constructed object... But that's not what you want here, as already stated.
Because implicit conversions decrease type safety.
The coordinates are in pixels, which are integral.
But you have still not mentioned why you don't want to use the correct way (mapPixelToCoords).
I thought of doing this as its own thread but since it's directly related to this decided against it.This is not related at all. You have a crash, and although it seems like it's caused by this conversion, I can tell you for sure it is not. Converting two integers to float has never caused any crash.