std::basic_string::operator[]
来自cppreference.com
< cpp | string | basic string
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
reference operator[]( size_type pos ); |
||
const_reference operator[]( size_type pos ) const; |
||
返回指定位置处的字符
pos
的参考。没有执行边界检查.Original:
Returns a reference to the character at specified location
pos
. No bounds checking is performed.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
If pos==size(),
- const版本返回一个引用到的字符值CharT()(空字符)。 (至 C++11)Original:The const version returns a reference to the character with value CharT() (the null character). (至 C++11)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - 这两个版本返回一个引用到的字符值CharT()(空字符)。修改的空字符导致未定义的行为,通过非const引用。 (C++11 起)Original:Both versions returns a reference to the character with value CharT() (the null character). Modifying the null character through non-const reference results in undefined behavior. (C++11 起)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] 参数
pos | - | 返回的字符位置
Original: position of the character to return The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[编辑] 返回值
引用到所请求的字符
Original:
reference to the requested character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 复杂性
常数
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 另请参阅
访问指定的字符的边界检查 Original: access specified character with bounds checking The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) |