id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 2532,ptr_set::erase(const T&) does not update the tree,ayba@…,Thorsten Ottosen,"Hi In some cases ptr_set::erase(const T&) deletes the object as expected but does not remove the node in the tree. => the tree is left with a dangling pointer Consider the following example: {{{ #include #include #include using namespace std; class Int { public: Int (int v) : val (v) { cout << ""\t\tnew: "" << this << "" -> "" << val << endl; } ~Int () { cout << ""\t\tdelete: "" << this << "" -> "" << val << endl; } bool operator< (const Int& b) const { return val < b.val; } int val; }; int main() { boost::ptr_set s; s.insert (new Int (3)); s.insert (new Int (1)); s.insert (new Int (2)); BOOST_FOREACH (Int& i, s) { cout << &i << "" -> "" << i.val << endl; } cout << endl; s.erase (Int(2)); BOOST_FOREACH (Int& i, s) { cout << &i << "" -> "" << i.val << endl; } return 0; } }}} --> output {{{ new: 0x9759008 -> 3 new: 0x9759030 -> 1 new: 0x9759058 -> 2 0x9759030 -> 1 0x9759058 -> 2 0x9759008 -> 3 new: 0xbfe387ac -> 2 delete: 0x9759058 -> 2 <---- object deleted delete: 0xbfe387ac -> 2 0x9759030 -> 1 0x9759058 -> 0 <---- dangling node/pointer !!! 0x9759008 -> 3 delete: 0x9759030 -> 1 delete: 0x9759058 -> 0 <---- object deleted again !!! delete: 0x9759008 -> 3 }}}",Bugs,closed,Boost 1.38.0,ptr_container,Boost Development Trunk,Problem,fixed,ptr_set erase,