I've written a program for an assignment which utilises doubly-linked lists using the STL.
I create a class like so:
Which has a clear method like so:
unsigned int row_number, char_position, row_size;
And I create a list of objects of this class:
So in the following code, I'm reading a line into a list of chars which is saved to a row object, then I add that row object to a list of row objects (maze_rows) and subsequently clear the list of chars and begin again.
int main (int argc, char *argv)
At the end of main I include the following code:
void load_maze(list<row> &maze_rows, string arg)
filein = arg;
//open stream to filein
cerr << "Unable to load maze " << filein << " \n";
list<row>::iterator itr = maze_rows.begin();
if(ch == '\n')
What I want to know is, is this effectively freeing up any memory I had been using for these lists? My grasp on memory management is a bit hazy because I've only ever programmed in Java before and it wasn't that necessary.
void clear_rows(list<row> &maze_rows)
for(list<row>::iterator list_iter = maze_rows.begin();
list_iter != maze_rows.end(); list_iter++)
Thanks in advance for all your help!