basic_string::size_type

Ein vorzeichenlose Typ ganzen Zahl, der die Anzahl der Elemente und Indizes in einer Zeichenfolge darstellen kann.

typedef typename allocator_type::size_type size_type;

Hinweise

Es ist zu allocator_type::size_type entsprechend.

Für Typ string, ist es zu size_t entsprechend.

Beispiel

// 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;
}
  
  

Anforderungen

Header: <string>

Namespace: std

Siehe auch

Referenz

basic_string Class