共用方式為


basic_string::value_type

A type that represents the type of characters stored in a string.

typedef typename allocator_type::value_type value_type;

Remarks

It is equivalent to traits_type::char_type and is equivalent to char for objects of type string.

Example

// 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;
}
The character ch1 is: G.
The character ch2 is: H.

Requirements

Header: <string>

Namespace: std

See Also

Reference

basic_string Class