C++ 类模板和多文件编译
By mw
@
// matrix.hpp template<class T> class TMatrix { // Declarations... };
#include "matrix.cpp" // Definitions
// matrix.hpp
template<class T> class TMatrix { // Declarations... };
// matrix.cpp
#include "matrix.cpp"
... // Definitions
// main.cpp #include "matrix.hpp"
int main() { TMatrix<int> Matrix; Matrix.row(); return 0; }