My destructor works, but I wanted to check to see if it's correct to do it this way. Here's the code first for the default constructor:

Now the destructor:Code:template<typename T, int n> Matrix<T, n>::Matrix() { T** arr = new T*[n]; for (int i = 0; i < n; ++i) { arr[i] = new T[n]; } for (int i = 0; i < n; ++i) // rows { for (int j = 0; j < n; ++j) // columns { arr[i][j] = 0; // T must define 0 and 1 } } content = arr; }

correct? it at least seems to me that just delete [] content wouldn't set the individual blocks pointed to back as available memory.Code:// destructor template<typename T, int n> Matrix<T, n>::~Matrix() { // free memory on each row for (int i = 0; i < n; ++i) { delete [] content[i]; content[i] = NULL; } // delete content entirely delete [] content; content = NULL; }