Pieter Louw on Mon, 03 Mar 2003 13:34:38 +0200 (SAST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Linux dev] STL and pointers


Hi there,

When you have a STL container with pointers, do you still need to delete the
pointers when you erase an item, or does the container handle the memory
management?

Example:

vector <Item*> items;

items->push_back(new Item());

//do stuff

items->pop_back();

/*does this delete the pointer, or do you have to delete it yourself like:
		delete items.back();
		items->pop_back();
*/

Thanks in advance

Pieter