I created a template matrix class and some appropriate binary operators like:
Expand|Select|Wrap|Line Numbers
- template <typename ContainedType>
- Matrix<ContainedType> operator+ (const Matrix<ContainedType>& lhs, const Matrix<ContainedType>& rhs)
- { ... }
Expand|Select|Wrap|Line Numbers
- assert(lhs.rows == rhs.rows && lhs.columns == rhs.columns);
I think this could be well modeled with types because usually there are no valid operations between different types. And with templates one could define a type "on demand".
So I'm thinking of a syntax like:
Expand|Select|Wrap|Line Numbers
- Matrix<float, 4, 4> matrix_4x4;
Matrix<float, 3, 3> ...
So is there a way to do this with templates? Or any other way?
Thanks in advance,
Harinezumi