Description :
-
Returns a reference to the element at position n in the vector.
-
If the position is not present in the vector, it throws exception of type out_of_range
Example:
// Create a vector of 5 integers
std::vector<int> myVector{1, 2, 3, 4, 5};
// Display the contents of vector using std::vector::at.
for (int i = 0; i < 5; i ) {
std::cout << myVector.at(i) << " ";
}