char_traits::eq
Testuje, zda dva char_type znaky jsou stejné.
static bool eq(
const char_type& _Ch1,
const char_type& _Ch2
);
Parametry
_Ch1
První dva znaky zkouší rovnosti._Ch2
Druhé dva znaky zkouší rovnosti.
Vrácená hodnota
true Pokud první znak je rovna hodnotě druhého znaku; jinak false.
Příklad
// char_traits_eq.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';
// Testing for equality
bool b1 = char_traits<char>::eq ( ch1 , ch2 );
if ( b1 )
cout << "The character ch1 is equal "
<< "to the character ch2." << endl;
else
cout << "The character ch1 is not equal "
<< "to the character ch2." << endl;
// An equivalent and alternatively test procedure
if ( ch1 == ch3 )
cout << "The character ch1 is equal "
<< "to the character ch3." << endl;
else
cout << "The character ch1 is not equal "
<< "to the character ch3." << endl;
}
Požadavky
Hlavička: <string>
Obor názvů: std