STL vectors perform bounds checking when the .at()
member function is called, but do not perform any checks on the []
operator.
When out of bounds, the []
operator produces undefined results.
More Related Contents:
- How does vector’s growth function work? [closed]
- How do I print out the contents of a vector?
- How do I print out the contents of a vector?
- Concatenating two std::vectors
- How to shuffle a std::vector?
- Correct way to work with vector of arrays
- How do I sort a vector of pairs based on the second element of the pair?
- How does the capacity of std::vector grow automatically? What is the rate?
- Nice way to append a vector to itself
- How to remove duplicates from unsorted std::vector while keeping the original ordering using algorithms?
- Vector of const objects giving compile error
- C++ valarray vs. vector
- Is std::vector copying the objects with a push_back?
- vector::at vs. vector::operator[]
- How do I sort the texture positions based on the texture indices given in a Wavefront (.obj) file?
- Performance issue for vector::size() in a loop in C++
- Vector of std::function with different signatures
- Unresolved externals in C++ when using vectors and find
- Reading and writing a std::vector into a file correctly
- vector push_back calling copy_constructor more than once?
- May std::vector make use of small buffer optimization?
- Why doesn’t vector::clear remove elements from a vector?
- How to compare two vectors for equality element by element in C++?
- Converting between C++ std::vector and C array without copying
- std::vector resize downward
- What is better: reserve vector capacity, preallocate to size or push back in loop?
- std::dynarray vs std::vector
- Is there a standard way of moving a range into a vector?
- How to cheaply assign C-style array to std::vector?
- What is the difference between const int*, const int * const, and int const *?