If you would have that in a program that uses it -- for example:
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
using std::cout;
using std::endl;
// insert your code here
int main() {
SM fubar;
return 0;
}
Would that compile (i.e. without errors)?
Would there be any compiler warnings?
Would the program run, or crash?
What is the purpose of the type SM? What idea does it implement?
The owner is responsible of orderly deallocation of owned resources. That involves both destruction and assignment (copy/move). What resources does an SM object own?
Does the example program above "use destructor"? If yes, where? If no, should it?
Generally you'd iterate through your custom structure and delete every new thing you created.
But yeah, as keskiverto said, this likely doesn't compile (love those posts). 'initrow' and 'initcolumn' are especially absent.
in words,
it looks like you need to delete the entire linked list (node by node, since you allocated it this way, classic linked list destroy function) and set head, tail, and possibly other pointers to null as you unwind. It can be done various ways but recursion down to the last node and then destroy as you back out is fairly simple code.
Totally none of my business and an aside, but typically the POINT of a sparse matrix scheme is to avoid storing zeroed out elements. I can't tell for sure but it looks like you are storing those ?! Generally, you store (row, column, value) and if a location is not in your storage, its zero, but unstored to save space. There are any number of nifty schemes to store these, but that is the concept.