Compartir a través de


operator< <regex>

Menor que la comparación para varios objetos.

template<class BidIt>
    bool operator<(const sub_match<BidIt>& left,
        const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
    bool operator<(
        const basic_string<typename iterator_traits<BidIt>::value_type, IOtraits, Alloc>& left,
        const sub_match<BidIt>& right);
template<class BidIt, class IOtraits, class Alloc>
    bool operator<(const sub_match<BidIt>& left,
        const basic_string<typename iterator_traits<BidIt>::value_type, IOtraits, Alloc>& right);
template<class BidIt>
    bool operator<(const typename iterator_traits<BidIt>::value_type *left,
        const sub_match<BidIt>& right);
template<class BidIt>
    bool operator<(const sub_match<BidIt>& left,
        const typename iterator_traits<BidIt>::value_type *right);
template<class BidIt>
    bool operator<(const typename iterator_traits<BidIt>::value_type& left,
        const sub_match<BidIt>& right);
template<class BidIt>
    bool operator<(const sub_match<BidIt>& left,
        const typename iterator_traits<BidIt>::value_type& right);

Parámetros

  • BidIt
    El tipo del iterador.

  • IOtraits
    la clase de los rasgos de la cadena.

  • Alloc
    La clase de asignador.

  • left
    el objeto izquierdo a comparar.

  • right
    el objeto correcto a comparar.

Comentarios

Cada operador de plantilla convierte los argumentos a un tipo string y devuelve true solo si el valor convertido de left compara menor que el valor convertido de right.

Ejemplo

 

// std_tr1__regex__operator_lt.cpp 
// compile with: /EHsc 
#include <regex> 
#include <iostream> 
 
typedef std::cmatch::string_type Mystr; 
int main() 
    { 
    std::regex rx("c(a*)|(b)"); 
    std::cmatch mr; 
 
    std::regex_search("xcaaay", mr, rx); 
 
    std::csub_match sub = mr[1]; 
    std::cout << "sub == " << sub << std::endl; 
    std::cout << std::endl; 
 
    std::cout << "sub < sub == " << std::boolalpha 
        << (sub < sub) << std::endl; 
 
    std::cout << "string(\"aab\") < sub == " << std::boolalpha 
        << (Mystr("aab") < sub) << std::endl; 
    std::cout << "sub < string(\"aab\") == " << std::boolalpha 
        << (sub < Mystr("aab")) << std::endl; 
 
    std::cout << "\"aab\" < sub == " << std::boolalpha 
        << ("aab" < sub) << std::endl; 
    std::cout << "sub < \"aab\" == " << std::boolalpha 
        << (sub < "aab") << std::endl; 
 
    std::cout << "'a' < sub == " << std::boolalpha 
        << ('a' < sub) << std::endl; 
    std::cout << "sub < 'a' == " << std::boolalpha 
        << (sub < 'a') << std::endl; 
 
    return (0); 
    } 
 
  

Requisitos

encabezado: <regex>

espacio de nombres: std

Vea también

Referencia

<regex>

operator== <regex>

operator!= <regex>

operator<= <regex>

operator> <regex>

operator>= <regex>