模板小例子
#include <iostream> template<typename T, std::size_t n> class SquareMatrix{ public: void invert(); }; template<typename T, std::size_t n> void SquareMatrix<T, n>::invert() { T num = n * 5; } int main() { SquareMatrix<double, 5> a; a.invert(); return 0; }