I have a template with this static cast operator:
operator Vector2<float>() const
{
return Vector2<float>(x, y);
}
This implies to me that if I cast as a float, it will return a float variant of the class, even if x and y are integers from an integer variant. But apparently not so:
As a test:
Vector2<float>position=static_cast<float>(Vector2<int>(5,5));
I get the compiler error for *No matching conversion for static_cast from Vector2 to float*.
Yet, the conversion is specified above, is it not, as a static cast overload?
You should use it like this:
since the declaration specified a conversion to
Vector2<float>, not a conversion tofloat.