What is the right thing to do? I know that if the container is of base class value type, then derived object stored is \'sliced\'. If container is of derived class type, the
If you want polymorphic behavior (and you do want it), then you must use pointers or references. That is well documented in many places.
And since you cannot use containers of references, you have to use containers of pointers.
Now, you can use any type of pointer you see fit: unique_ptr, shared_ptr or raw pointers.