23 Strings library [strings]

23.4 String classes [string.classes]

23.4.3 Class template basic_string [basic.string]

23.4.3.6 Element access [string.access]

constexpr const_reference operator[](size_type pos) const; constexpr reference operator[](size_type pos);
Preconditions: pos <= size().
Returns: *(begin() + pos) if pos < size().
Otherwise, returns a reference to an object of type charT with value charT(), where modifying the object to any value other than charT() leads to undefined behavior.
Throws: Nothing.
Complexity: Constant time.
constexpr const_reference at(size_type pos) const; constexpr reference at(size_type pos);
Returns: operator[](pos).
Throws: out_of_range if pos >= size().
constexpr const charT& front() const; constexpr charT& front();
Preconditions: !empty().
Effects: Equivalent to: return operator[](0);
constexpr const charT& back() const; constexpr charT& back();
Preconditions: !empty().
Effects: Equivalent to: return operator[](size() - 1);