◐ Shell
clean mode source ↗

std::basic_string::operator[] — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

reference operator[]( size_type pos );

const_reference operator[]( size_type pos ) const;

Renvoie une référence au caractère à pos emplacement spécifié. Aucune vérification de limites est effectuée .

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.

If pos==size(),

  • La version const retourne une référence au caractère avec la valeur CharT() (le caractère nul). (avant C++11)

    Original:

    The const version returns a reference to the character with value CharT() (the null character). (avant C++11)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • Les deux versions renvoie une référence au caractère avec la valeur CharT() (le caractère nul). Modification du caractère nul grâce à des résultats de référence non-const à un comportement indéfini. (depuis 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. (depuis C++11)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Paramètres

pos -

position du caractère à retourner

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.

Retourne la valeur

référence au caractère requis

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.

Complexité

Constante

Original:

Constant

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Voir aussi

accède au caractère spécifié avec contrôle de bornes
(fonction membre publique) [edit]