stl container with std::unique_ptr’s vs boost::ptr_container
I decided to write up a short program that put a few polymorphic objects into a container (by pointer to heap), and then use that container with a std::algorithm. I chose std::remove_if just as an example. Here is how I would do it with vector<unique_ptr<T>>: #include <vector> #include <memory> #include <iostream> class Animal { public: … Read more