Partager via


basic_string::size_type

Type entier non signé qui peut représenter le nombre d'éléments et indices d'une chaîne.

typedef typename allocator_type::size_type size_type;

Notes

Il correspond à allocator_type::size_type.

Pour le type string, c'est correspond à size_t.

Exemple

// basic_string_size_type.cpp
// compile with: /EHsc
#include <string>
#include <iostream>

int main( ) 
{
   using namespace std;
   string str1 ( "Hello world" );

   basic_string <char>::size_type sizeStr1, capStr1;
   sizeStr1 = str1.size (  );
   capStr1 = str1.capacity (  );

   cout << "The current size of string str1 is: " 
        << sizeStr1 << "." << endl;
   cout << "The capacity of string str1 is: " << capStr1 
         << "." << endl;
}
  

Configuration requise

En-tête : <chaîne>

Espace de noms : std

Voir aussi

Référence

basic_string, classe