# operator==,!=,<,<=,>,>=(std::sub_match)

From cppreference.com
< cpp‎ | regex‎ | sub match

Defined in header `<regex>` |  |
Direct comparison |  |
template< class BidirIt > bool operator==( const sub_match<BidirIt>& lhs, const sub_match<BidirIt>& rhs ); | (1) | (since C++11)
template< class BidirIt > bool operator!=( const sub_match<BidirIt>& lhs, const sub_match<BidirIt>& rhs ); | (2) | (since C++11)
template< class BidirIt > bool operator<( const sub_match<BidirIt>& lhs, const sub_match<BidirIt>& rhs ); | (3) | (since C++11)
template< class BidirIt > bool operator<=( const sub_match<BidirIt>& lhs, const sub_match<BidirIt>& rhs ); | (4) | (since C++11)
template< class BidirIt > bool operator>( const sub_match<BidirIt>& lhs, const sub_match<BidirIt>& rhs ); | (5) | (since C++11)
template< class BidirIt > bool operator>=( const sub_match<BidirIt>& lhs, const sub_match<BidirIt>& rhs ); | (6) | (since C++11)
`std::basic_string` and `std::sub_match` |  |
template< class BidirIt, class Traits, class Alloc > bool operator==( const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& lhs, const sub_match<BidirIt>& rhs ); | (7) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator!=( const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& lhs, const sub_match<BidirIt>& rhs ); | (8) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator<( const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& lhs, const sub_match<BidirIt>& rhs ); | (9) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator<=( const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& lhs, const sub_match<BidirIt>& rhs ); | (10) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator>( const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& lhs, const sub_match<BidirIt>& rhs ); | (11) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator>=( const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& lhs, const sub_match<BidirIt>& rhs ); | (12) | (since C++11)
`std::sub_match` and `std::basic_string` |  |
template< class BidirIt, class Traits, class Alloc > bool operator==( const sub_match<BidirIt>& lhs, const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& rhs ); | (13) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator!=( const sub_match<BidirIt>& lhs, const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& rhs ); | (14) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator<( const sub_match<BidirIt>& lhs, const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& rhs ); | (15) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator<=( const sub_match<BidirIt>& lhs, const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& rhs ); | (16) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator>( const sub_match<BidirIt>& lhs, const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& rhs ); | (17) | (since C++11)
template< class BidirIt, class Traits, class Alloc > bool operator>=( const sub_match<BidirIt>& lhs, const std::basic_string< typename std::iterator_traits<BidirIt>::value_type, Traits,Alloc>& rhs ); | (18) | (since C++11)
`std::iterator_traits<BidirIt>::value_type*` and `std::sub_match` |  |
template< class BidirIt > bool operator==( const typename std::iterator_traits<BidirIt>::value_type* rhs, const sub_match<BidirIt>& rhs ); | (19) | (since C++11)
template< class BidirIt > bool operator!=( const typename std::iterator_traits<BidirIt>::value_type* rhs, const sub_match<BidirIt>& rhs ); | (20) | (since C++11)
template< class BidirIt > bool operator<( const typename std::iterator_traits<BidirIt>::value_type* rhs, const sub_match<BidirIt>& rhs ); | (21) | (since C++11)
template< class BidirIt > bool operator<=( const typename std::iterator_traits<BidirIt>::value_type* rhs, const sub_match<BidirIt>& rhs ); | (22) | (since C++11)
template< class BidirIt > bool operator>( const typename std::iterator_traits<BidirIt>::value_type* rhs, const sub_match<BidirIt>& rhs ); | (23) | (since C++11)
template< class BidirIt > bool operator>=( const typename std::iterator_traits<BidirIt>::value_type* rhs, const sub_match<BidirIt>& rhs ); | (24) | (since C++11)
`std::sub_match` and `std::iterator_traits<BidirIt>::value_type*` |  |
template< class BidirIt > bool operator==( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type* rhs ); | (25) | (since C++11)
template< class BidirIt > bool operator!=( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type* rhs ); | (26) | (since C++11)
template< class BidirIt > bool operator<( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type* rhs ); | (27) | (since C++11)
template< class BidirIt > bool operator<=( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type* rhs ); | (28) | (since C++11)
template< class BidirIt > bool operator>( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type* rhs ); | (29) | (since C++11)
template< class BidirIt > bool operator>=( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type* rhs ); | (30) | (since C++11)
`std::iterator_traits<BidirIt>::value_type` and `std::sub_match` |  |
template< class BidirIt > bool operator==( const typename std::iterator_traits<BidirIt>::value_type& rhs, const sub_match<BidirIt>& rhs ); | (31) | (since C++11)
template< class BidirIt > bool operator!=( const typename std::iterator_traits<BidirIt>::value_type& rhs, const sub_match<BidirIt>& rhs ); | (32) | (since C++11)
template< class BidirIt > bool operator<( const typename std::iterator_traits<BidirIt>::value_type& rhs, const sub_match<BidirIt>& rhs ); | (33) | (since C++11)
template< class BidirIt > bool operator<=( const typename std::iterator_traits<BidirIt>::value_type& rhs, const sub_match<BidirIt>& rhs ); | (34) | (since C++11)
template< class BidirIt > bool operator>( const typename std::iterator_traits<BidirIt>::value_type& rhs, const sub_match<BidirIt>& rhs ); | (35) | (since C++11)
template< class BidirIt > bool operator>=( const typename std::iterator_traits<BidirIt>::value_type& rhs, const sub_match<BidirIt>& rhs ); | (36) | (since C++11)
`std::sub_match` and `std::iterator_traits<BidirIt>::value_type` |  |
template< class BidirIt > bool operator==( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type& rhs ); | (37) | (since C++11)
template< class BidirIt > bool operator!=( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type& rhs ); | (38) | (since C++11)
template< class BidirIt > bool operator<( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type& rhs ); | (39) | (since C++11)
template< class BidirIt > bool operator<=( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type& rhs ); | (40) | (since C++11)
template< class BidirIt > bool operator>( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type& rhs ); | (41) | (since C++11)
template< class BidirIt > bool operator>=( const sub_match<BidirIt>& lhs, const typename std::iterator_traits<BidirIt>::value_type& rhs ); | (42) | (since C++11)

Compares a `sub_match` to another `sub_match`, a string, a null-terminated character sequence or a character.

1-6) Compares two sub_match directly by comparing their underlying character sequences. Implemented as if by lhs.compare(rhs)
7-18) Compares a sub_match with a std::basic_string. Implemented as if by sm.compare(typename sub_match<BidirIt>::string_type(st.data(), st.size()), where `sm` is the `sub_match` argument and `st` is the `basic_string` argument.
19-30) Compares a sub_match with a null-terminated string. Implemented as if by sm.compare(s), where `sm` is the `sub_match` and `s` is the pointer to a null-terminated character string.
31-42) Compares a sub_match with a character. Implemented as if by sm.compare(typename sub_match<BidirIt>::string_type(1, ch)), where `sm` is a `sub_match` and `ch` is a character.

### Parameters

lhs, rhs | - | a `sub_match`, `basic_string`, pointer to a null-terminated string or a character to compare

### Return value

true if the corresponding comparison holds as defined by std::sub_match::compare(), false otherwise.

### Example

| This section is incomplete Reason: no example

### See also

compare | compares matched subsequence (if any) (public member function)

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/regex/sub_match/operator_cmp&oldid=110370"