C++ Language/Std/Stl/CollectionClasses/SequenceCollections/Vector/Indexing

Both the C-array-operator and   allow random access to a vector's items. They differ in how they handle the error of a non-existent item. Because either of them provides a reference to that item, indexing can be used for getting it and for setting it.

A reference is also returned by the special names for the first and last items  and.

Additional information about vector indexing (includes interactive examples)