template <class T1, class T2>
Vec3<T1> Convert(const Vec3<T2> & v) {
return Vec3(T1(v[0]), T1(v[1]), T1(v[2]));
}
template <class T>
Vec3<T> Convert<T, T>(const Vec3<T> & v) { // <-- here is the "syntax" question
return v;
}
template <class T1, class T2>
Vec3<T1> Convert(const Vec3<T2> & v) {
return Vec3(T1(v[0]), T1(v[1]), T1(v[2]));
}
template <class T>
Vec3<T> Convert<T, T>(const Vec3<T> & v) { // <-- here is the "syntax" question
return v;
}
template <typename T1, typename T2>struct Convert{ Vec3<T1> convert(const Vec3<T2> & v) { return Vec3(T1(v[0]), T1(v[1]), T1(v[2])); }};template <typename T>struct Convert<T,int>{ Vec3<T> convert(const Vec3<int> & v) { return v; }};
namespace detail{ template <typename T1, typename T2> struct converter { typedef Vec<T1> result_type; typedef Vec<T2> argument_type; static result_type convert()(const argument_type& arg) { return result_type(T1(arg[0]), T1(arg[1]), T1(arg[2])); } }; template <typename T> struct converter<T,T> { typedef Vec<T> result_type; typedef Vec<T> argument_type; static result_type convert()(const argument_type& arg) { return arg; } };}template<class T1, class T2>typename detail::converter<T1,T2>::result_type convert(const T2& arg){ return detail::converter<T1,T2>::convert(arg);}
template<typename T>struct Vec3{ Vec3() {} Vec3(T x, T y, T z) : x(x), y(y), z(z) {} Vec3(const Vec3& copy) : x(copy.x), y(copy.y), z(copy.z) {} template<typename S> explicit Vec3(const Vec3<S>& copy) : x(copy.x), y(copy.y), z(copy.z) {}};Vec3<int> origin(0,0,0);Vec3<float> origin2(Vec3<float>(origin));