You can access and store values the same way in both containers. Just std::vector gives you more options to do so, is much safer and dynamically sized (can store an unspecified, growing number of objects).
As ResidentBiscuit said, accessing a "std::vector" and an array is identical when the sub-script operator is used. Accessing a "std::vector" and an array with the sub-script operator never explicitly throw exceptions unless the OS believes you're accessing unowned memory.
Microsoft's & GNU's implementation of "std::vector::operator[]( )" never throw exceptions, nor do they check if the index is out-of-range.
Microsoft's & GNU's implementation of "std::vector::operator[]( )" never throw exceptions, nor do they check if the index is out-of-range.
You can make GCC check this by defining the the macro _GLIBCXX_DEBUG when compiling your program. It will print an error message and terminate the program.
> Microsoft's & GNU's implementation of "std::vector::operator[]( )" never throw exceptions,
> nor do they check if the index is out-of-range.
std::vectir<>::at() would become redundant if std::vecto<>r::operator[]( ) also provided for bounds-checked access.
Both std::vector<>, and std::deque<> leave that decision to the programmer who uses the container.