Share via


char_traits::lt

Comprueba si un carácter es menor que otro.

static bool lt(
   const char_type& _Ch1, 
   const char_type& _Ch2 
);

Parámetros

  • _Ch1
    El primer de dos caracteres que se van a comprobar para menor que.

  • _Ch2
    El segundo de dos caracteres que se van a comprobar para menor que.

Valor devuelto

TRUE si el primer carácter es menor que el segundo carácter; si no Falso.

Ejemplo

// char_traits_lt.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 =  'z';

   // Testing for less than
   bool b1 = char_traits<char>::lt ( ch1 , ch2 );
   if ( b1 )
      cout << "The character ch1 is less than "
           << "the character ch2." << endl;
   else
      cout << "The character ch1 is not less "
           << "than the character ch2." << endl;

   // An equivalent and alternatively test procedure
   if ( ch3 <  ch2 )
      cout << "The character ch3 is less than "
           << "the character ch2." << endl;
   else
      cout << "The character ch3 is not less "
           << "than the character ch2." << endl;
}
  
  

Requisitos

encabezado: <cadena>

espacio de nombres: std

Vea también

Referencia

char_traits Struct