Should a custom container wrapper for std :: vector inherit or contain std :: vector?

Should a custom container that is a wrapper for std :: vector inherit or contain std :: vector?

I have a class that should be a container. I see two options:

1) inherit from vector 2) have a private member vector and redefine all vector functions so that my container acts as a vector

I'm not sure if this is just a matter of style, or is one of the methods fundamentally better than the other?

The additional functionality I want to add is small, a few data elements and functions here and there. Basically, these are convenient functions for working with data in a vector.

+4
source share
2

, STL . .

-, / , , / .

. , .

+10

- std::vector

, , std::vector, , . ? , , ?

0

All Articles