I have a template class that looks like this:
template <typename T, std::size_t M, std::size_t N> // MxN matrix with elements of type T
struct Mtx{...}
// component wise division
template <typename U> Mtx operator/(const Mtx<U, M, N> &rhs) const
{ return componentDivide(*this, rhs); }
What is the best way to ensure that the return type of functions like operator /
is "correct"?
eg:
Mtx<float> * Mtx<unsigned> = Mtx<float>
Mtx<float> * Mtx<int> = Mtx<float>
Mtx<float> * Mtx<double> = Mtx<double>
Mtx<double> * Mtx<float> = Mtx<double>
Mtx<short> * Mtx<int> = Mtx<int>
Aucun commentaire:
Enregistrer un commentaire