char_traits::eq_int_type
Sprawdza, czy dwa znaki reprezentowane jako int_types są równe, czy nie.
static bool eq_int_type(
const int_type& _Ch1,
const int_type& _Ch2
);
Parametry
_Ch1
Pierwsze dwa znaki badania na równości, jako int_types._Ch2
Drugi z dwoma znakami badania na równości, jako int_types.
Wartość zwracana
TRUE Jeśli pierwszy znak jest równa drugiego znaku; w przeciwnym razie false.
Przykład
// 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;
}
Wymagania
Nagłówek: <ciąg>
Przestrzeń nazw: std