After reading timdays answer to this question I am curious about the difference between boost::ptr_container
and a std::vector<shared_ptr>
. I was under the impression that a boost::ptr_container
had ownership over the pointers given to it, and upon release would call the destructors of all the pointers it contained regardless of other references to its inhabitants. Which is contrary to the purpose of a std::vector<shared_ptr>
, which after release would only release the pointers themselves if the ref count was 0?
If this is the case (I assume it isn't), why would even the Boost documentation example compare the two as though they are similar in purpose, and why would timday's answer propose a boost::ptr_container
when it is very different to the purpose of a std::vector<shared_ptr>
.