Templatized Matrix class in C++