Bibliothèque de chaînes C ++ - cend

La description

Il renvoie un const_iterator pointant sur le caractère après la fin de la chaîne.

Déclaration

Voici la déclaration pour std :: string :: cend.

const_iterator cend() const noexcept;

C ++ 11

const_iterator cend() const noexcept;

Paramètres

aucun

Valeur de retour

Il renvoie un const_iterator au-delà de la fin de la chaîne.

Exceptions

Ne jetez jamais d'exceptions.

Exemple

Dans l'exemple ci-dessous pour std :: string :: cend.

#include <iostream>
#include <string>

int main () {
   std::string str ("tutorialspoint india PVT Ltd");
   for (auto it=str.cbegin(); it!=str.cend(); ++it)
      std::cout << *it;
   std::cout << '\n';

   return 0;
}

L'exemple de sortie devrait être comme ceci -

tutorialspoint india PVT Ltd