meds
meds

Reputation: 22926

Removing a single pointer from a boost::ptr_list list?

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?

Upvotes: 0

Views: 1503

Answers (1)

Seth Johnson
Seth Johnson

Reputation: 15172

The pop_back() command deletes the last element of a list. Boost's implementation of ptr_list encapsulates a std::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.

Upvotes: 2

Related Questions