Share via


basic_string::size_type

可以表示項目和索引數目字串的不帶正負號的整數 (Unsigned Integer) 型別。

typedef typename allocator_type::size_type size_type;

備註

它與 allocator_type::size_type相當於。

如需型別 字串,它與 size_t相當於。

範例

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

需求

標題: <string>

命名空間: std

請參閱

參考

basic_string Class