C++ template return types -


i have 2 template classes, vector3 , matrix4x4. vector3 explicitly instantiated float, double , int, whereas matrix4x4 explicitly instantiated float , double.

i'm thinking return type user expect when multiplying them different types. internal multiplication happen such non-matching types promote 1 other, i'm not sure type return e.g.

vector3i vec3i(1, 2, 3);  matrix4x4f mat4f; //automatically set identity  auto result = vec3i * mat4f; auto result2 = mat4f * vec3i; 

in both cases think result , result2 should both vec3f, if multiply int float. guess i'm wondering if in line common practice, or if not if, instead of multiplying different types, should doing explicitly casting 1 other static_cast , casting operators?


Popular posts from this blog