2.6 KiB
[string.access]
27 Strings library [strings]
27.4 String classes [string.classes]
27.4.3 Class template basic_string [basic.string]
27.4.3.6 Element access [string.access]
constexpr const_reference operator[](size_type pos) const; constexpr reference operator[](size_type pos);
Hardened preconditions: pos <= size() is true.
Returns: *(begin() + pos) if pos < size().
Otherwise, returns a reference to an object of type charT with valuecharT(), where modifying the object to any value other thancharT() 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.
Throws: out_of_range ifpos >= size().
constexpr const charT& front() const; constexpr charT& front();
Hardened preconditions: empty() is false.
Effects: Equivalent to: return operator;
constexpr const charT& back() const; constexpr charT& back();
Hardened preconditions: empty() is false.
Effects: Equivalent to: return operator[](size() - 1);