bsl::basic_string::operator[]

Return a reference to the character at the specified position.

Synopsis

Declared in <bslstl_string.h>

reference
operator[](size_type position);

Description

Return a reference providing modifiable access to the character at the specified position in this string if position < length(), or a reference providing non-modifiable access to the null-terminating character if position == length(). The behavior is undefined unless position <= length(), and, in the case of position == length(), the null-terminating character is not modified through the returned reference.

Return Value

reference to the character at position

Parameters

NameDescription
positionstarting index