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, then base class object can not be stored. Right?
If to go with pointers, auto_ptr can not be used because it's have copy semantic problem. Is shared_ptr the only solutions to handle this problem?
Could anyone provide more details, sample code or online articles that address this issue? It should be quite a common question however i did not find much information on it in textbook or online.
Thanks in advance.
btw, i just search on unique_ptr. It does not seem to support copy semantics. So isn't it only safe than auto_ptr to be used in STL, but maybe due to lack to copy semantics, many STL operation or algorithm can not be used on container of unique_ptr?