std::vector::back
<vector>
reference back(); const_reference back() const;
Access last element
Returns a reference to the last element in the
vector.
Unlike member vector::end, which returns an iterator just past this element, this function returns a direct reference.
Calling this function on an empty container causes undefined behavior.
std::vector::front
<vector>
reference front(); const_reference front() const;
Access first element
Returns a reference to the first element in the
vector.
Unlike member vector::begin, which returns an iterator to this same element, this function returns a direct reference.
Calling this function on an empty container causes undefined behavior.
std::vector::at
<vector>
reference at (size_type n); const_reference at (size_type n) const;
Access element
Returns a reference to the element at position
n in the
vector.
The function automatically checks whether n is within the bounds of valid elements in the vector, throwing an out_of_range exception if it is not (i.e., if n is greater or equal than its size). This is in contrast with member operator[], that does not check against bounds.