C++ matrix class