Vector

The vector class has the behavior of a dynamic array; that is, there is indexed random access to items and the container will grow as more items are inserted into it. You can create a vector object with an initialization list, and with a specified number of copies of an item. You can also base a vector on values in another container by passing iterators that indicate the range of items in that container. You can create a vector with a pre-determined size by providing a capacity as the constructor parameter, and the specified number of default items will be created in the container. If, at a later stage, you need to specify the container size, you can call the reserve method to specify the minimum size or the resize method, which may ...

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.