I get compiler errors when trying to access the template member function of a template class from another template class. The call to the getSubmatrix function leads to compiler warnings, βthe result of the expression is not used,β about the parameters (0, 0) , and finally, in the case of a compiler error, βa reference to a non-stationary member function must be calledβ.
Matrix class:
template <std::size_t m, std::size_t n, typename T, std::size_t rowPadding = 0> class Matrix { public: ... template <std::size_t p, std::size_t q> Matrix<p, q, T, n - q>& getSubmatrix(std::size_t column, std::size_t row) { ... } };
Conversion Class:
template <typename T> class Transform { public: ... Matrix<4, 4, T> matrix() const { ... Matrix<4, 4, T> result; result.getSubmatrix<3, 3>(0, 0) = Matrix<3, 3, T>(); ... } };
Please note that changing the matrix type to Matrix<4, 4, float> , and not Matrix<4, 4, T> will lead to proper compilation. The clang 4.0 compiler, and the language version is C ++ 11.
source share