pushing a list into a list of lists with temp

Nov 25, 2012 at 5:33am
I have a list of lists and I want to add a prefabricated list using a temporary list in a function. In using a temporary list, when I reach the end of the scope will the data that was pushed back into the superlist be deleted? I'm not sure if it will or not because of how it works and the references in here don't go into detail on a list of lists scenario.

1
2
3
4
5
6
  list<vertex> edge; 
  vertex self; 
  self.weight = 0;
  self.name = name; 
  edge.push_back(self);
  m_edges.push_back(edge);


Given the code above, will m_edges have the sublist in there while out of the scope or will it be deleted? (m_edges is passed into the function and will be there outside)
Nov 25, 2012 at 6:00am
m_edges will retain it's copy of the list, provided it's a std:: container and not something that just looks like one.
Nov 25, 2012 at 6:00am
m_edges will retain it's copy of the list, provided it's a std:: container and not something that just looks like one.
Nov 25, 2012 at 6:54am
Yes, it is a std container, and Thank you!
Topic archived. No new replies allowed.