I want to inherit from std::map, but as far as I know std::map hasn\'t any virtual destructor.
Is it therefore possible to call std
I want to inherit from
std::map[...]
Why ?
There are two traditional reasons to inherit:
The former makes no sense here as map does not have any virtual method so you cannot modify its behavior by inheriting; and the latter is a perversion of the use of inheritance which only complicates maintenance in the end.
Without a clear idea of your intended usage (lack of context in your question), I will suppose that what you really want is to provide a map-like container, with some bonus operations. There are two ways to achieve this:
std::map, and provide the adequate interfacestd::mapThe latter is simpler, however it's also more open: the original interface of std::map is still wide-opened; therefore it is unsuitable for restricting operations.
The former is more heavyweight, undoubtedly, but offers more possibilities.
It's up to you to decide which of the two approaches is more suitable.