Why don’t STL containers have virtual destructors?

A virtual destructor is only useful for inheritance scenarios. STL containers are not designed to be inherited from (nor is it a supported scenario). Hence they don’t have virtual destructors.

Leave a Comment