共用方式為


basic_string::value_type

類型,表示字串中儲存之字元的類型。

typedef typename allocator_type::value_type value_type;

備註

它與 traits_type::char_type 相等並與型別 string物件的 char 。

範例

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

int main( ) 
{
   using namespace std;

   basic_string<char>::value_type ch1 = 'G';

   char ch2 = 'H';

   cout << "The character ch1 is: " << ch1 << "." << endl;
   cout << "The character ch2 is: " << ch2 << "." << endl;
}
  

需求

標頭:<string>

命名空間: std

請參閱

參考

basic_string 類別