char_traits::eq_int_type
int_typeとして表される 2 文字が等しいかどうかをテストします。
static bool eq_int_type(
const int_type& _Ch1,
const int_type& _Ch2
);
パラメーター
_Ch1
int_type、. として等価性をテストする 2 文字の狭い。_Ch2
int_type、. として等価性をテストする 2 文字の 2 番目の。
戻り値
最初の文字が 2 番目の文字と等しいtrue ; それ false。
使用例
// char_traits_eq_int_type.cpp
// compile with: /EHsc
#include <string>
#include <iostream>
int main( )
{
using namespace std;
char_traits<char>::char_type ch1 = 'x';
char_traits<char>::char_type ch2 = 'y';
char_traits<char>::char_type ch3 = 'x';
// Converting from char_type to int_type
char_traits<char>::int_type int1, int2 , int3;
int1 =char_traits<char>:: to_int_type ( ch1 );
int2 =char_traits<char>:: to_int_type ( ch2 );
int3 =char_traits<char>:: to_int_type ( ch3 );
cout << "The char_types and corresponding int_types are:"
<< "\n ch1 = " << ch1 << " corresponding to int1 = "
<< int1 << "."
<< "\n ch2 = " << ch2 << " corresponding to int1 = "
<< int2 << "."
<< "\n ch3 = " << ch3 << " corresponding to int1 = "
<< int3 << "." << endl << endl;
// Testing for equality of int_type representations
bool b1 = char_traits<char>::eq_int_type ( int1 , int2 );
if ( b1 )
cout << "The int_type representation of character ch1\n "
<< "is equal to the int_type representation of ch2."
<< endl;
else
cout << "The int_type representation of character ch1\n is "
<< "not equal to the int_type representation of ch2."
<< endl;
// An equivalent and alternatively test procedure
if ( int1 == int3 )
cout << "The int_type representation of character ch1\n "
<< "is equal to the int_type representation of ch3."
<< endl;
else
cout << "The int_type representation of character ch1\n is "
<< "not equal to the int_type representation of ch3."
<< endl;
}
必要条件
ヘッダー: <string>
名前空間: std