Everyone knows that you can use STL containers on polymorphic data but since you cannot inherit (safely) from STL types, people assume that you cannot have run-time polymorphic STL objects (ie. Run-time determination of what container type you are passing into an algorithm).
This can easily be achieved through a custom iterator type that contains a polymorphic member. In this way, the exterior iterator type (your custom iterator) passed to the algorithm is static, yet the iterator forwards operations to a polymorphic member whose type is run-time dependent.
That was a short quote from someone. But I have a hard time understanding his words and how to write a piece of code as to exemplify what he says.
for example
template<typename T>
class MyList:public std::list<T>
Why is this supposed to be unsafe ?
Thank you