
Mario Klebsch: ...
So, I thought, I might use a std::list of boost::weak_ptr. But my compiler complains about std::list::remove():
...
It seems, that the compiler does not find an operator== for the boost::weak_ptr.
weak_ptr has no operator==. You need to use remove_if instead of remove, passing it one of: bool eq( weak_ptr<Channel> const & p, weak_ptr<Channel> const & q ) { return p.lock() == q.lock(); } bool eq2( weak_ptr<Channel> const & p, weak_ptr<Channel> const & q ) { return !(p < q) && !(q < p); } Which one is better depends on your specific use case. The first one considers two weak_ptr instances to be equal when they point to the same object. The second one considers two weak_ptr instances to be equal when they are copies.