Consider the following classes
class Base {
public:
virtual void do_stuff() = 0;
};
class Derived : public Base {
public
virtual void do_stuff() { std::
Assuming from your context that Owner
is the sole owner of the contained objects,T
should be unique_ptr
(where unique_ptr
comes from boost or std depending on your C++11 availability). This properly recognizes that it's solely owned by the container and additionally shows the ownership transferral semantics in your add_item
call.