[#bsl-basic_string-0ce-operator_subs-08]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0ce.adoc[basic&lowbar;string&lt;char16&lowbar;t&gt;]::operator&lsqb;&rsqb;
:relfileprefix: ../../
:mrdocs:

Subscript operators

== Synopses

Declared in `&lt;bslstl&lowbar;string&period;h&gt;`

Return a reference providing modifiable access to the character at the specified `position` in this string if `position &lt; length()`, or a reference providing non&hyphen;modifiable access to the null&hyphen;terminating character if `position &equals;&equals; length()`&period; The behavior is undefined unless `position &lt;&equals; length()`, and, in the case of `position &equals;&equals; length()`, the null&hyphen;terminating character is not modified through the returned reference&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0ce/reference.adoc[reference]
xref:bsl/basic_string-0ce/operator_subs-0e.adoc[operator&lsqb;&rsqb;](xref:bsl/basic_string-0ce/size_type.adoc[size&lowbar;type] position);
----

[.small]#xref:bsl/basic_string-0ce/operator_subs-0e.adoc[_» more&period;&period;&period;_]#

Return a reference providing non&hyphen;modifiable access to the character at the specified `position` in this string&period; The behavior is undefined unless `position &lt;&equals; length()`&period; Note that if `position &equals;&equals; length()`, a reference to the null&hyphen;terminating character is returned&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/basic_string-0ce/const_reference.adoc[const&lowbar;reference]
xref:bsl/basic_string-0ce/operator_subs-0b.adoc[operator&lsqb;&rsqb;](xref:bsl/basic_string-0ce/size_type.adoc[size&lowbar;type] position) const;
----

[.small]#xref:bsl/basic_string-0ce/operator_subs-0b.adoc[_» more&period;&period;&period;_]#


[.small]#Created with https://www.mrdocs.com[MrDocs]#
