Re: RDragon1 - As explained by Hodgman, why should it operate on all types? The function is not meant to do that.
Also, now I can do something like this:
// Old way.vec2<int> v1(1, 1);vec2<float> temp((float)v1.x, (float)v1.y);vec2<float> v = temp * 2.5f;// New way.vec2<int> v1(1, 1);vec2<float> v = v1.to<float>() * 2.5f;
Overall, it is really just a matter of convenience (not an algorithm design problem). I am happy with the current solution.
Edit: here is the code -
template <typename T>class vec2 {public: T x, y;... template <typename Y> vec2<Y> to() const { return (vec2<Y> ((Y)x, (Y)y)); }};
[Edited by - Doggan on May 15, 2008 3:44:57 AM]