Boost logo

Boost Users :

Subject: [Boost-users] shared_ptr and std::set::erase
From: Javier Jerónimo (jjeronimo_at_[hidden])
Date: 2008-10-09 06:46:49


Hello,
I have:

std::set< boost::shared_ptr< A > > m_set;

and when I try to do:

m_set.erase( somesharedptr );

the shared_ptr is not removed from the set. There is already a shared_ptr
object pointing to the same A object inside the set.
I think it's because the definition of "shared_ptr<>::operator<" and its use
in std::set<>::erase.

What's the correct way of using a shared_ptr inside a set?

Thanks.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net