Return a reference to the character at the specified position.

Synopsis

Declared in <bslstl_string.h>

const_reference
operator[](size_type position) const;

Description

Return a reference providing non‐modifiable access to the character at the specified position in this string. The behavior is undefined unless position <= length(). Note that if position == length(), a reference to the null‐terminating character is returned.

Return Value

reference to the character at position

Parameters

Name

Description

position

starting index

Created with MrDocs