Implentation of an n-dimensional Matrix class in C++