次の方法で共有


basic_string::value_type

文字の型を表す型は、文字列に格納された。

typedef typename allocator_type::value_type value_type;

解説

これは traits_type::char_type と同じに [文字列]、型のオブジェクトの 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 Class