If I create a bunch of elements in a boost::ptr_list container how can I remove individual pointers from it? Say I do this:
boost::ptr_list intlist;
int *i = new int(3);
intlist.Add(i);
int *i2 = new int(1);
intlist.Add(i2);
int *i3 = new int(6);
intlist.Add(i3);
How can I remove say i3 and not i or i2 from the list?
The
pop_back()command deletes the last element of a list. Boost’s implementation ofptr_listencapsulates astd::list, so all of the commands on this page are equally valid with Boost’s pointer wrappers.Since you changed your question, see the erase command. You won’t find an answer except by using the std::list interface.