operator==,!=,<,<=,>,>=,<=>(std::sub_match)
| Defined in header  <regex> | ||
| Direct comparison | ||
| template< class BidirIt > bool operator==( const std::sub_match<BidirIt>& lhs,  | (1) | (since C++11) | 
| template< class BidirIt > bool operator!=( const std::sub_match<BidirIt>& lhs,  | (2) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<( const std::sub_match<BidirIt>& lhs,  | (3) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<=( const std::sub_match<BidirIt>& lhs,  | (4) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>( const std::sub_match<BidirIt>& lhs,  | (5) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>=( const std::sub_match<BidirIt>& lhs,  | (6) | (since C++11) (until C++20) | 
| template< class BidirIt > /*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& lhs,  | (7) | (since C++20) | 
| std::sub_matchandstd::basic_string | ||
| template< class BidirIt, class Traits, class Alloc > bool operator==( const std::sub_match<BidirIt>& sm, | (8) | (since C++11) | 
| template< class BidirIt, class Traits, class Alloc > bool operator!=( const std::sub_match<BidirIt>& sm, | (9) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator<( const std::sub_match<BidirIt>& sm, | (10) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator<=( const std::sub_match<BidirIt>& sm, | (11) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator>( const std::sub_match<BidirIt>& sm, | (12) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator>=( const std::sub_match<BidirIt>& sm, | (13) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > /*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& sm,  | (14) | (since C++20) | 
| std::basic_stringandstd::sub_match | ||
| template< class BidirIt, class Traits, class Alloc > bool operator==( const std::basic_string< | (15) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator!=( const std::basic_string< | (16) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator<( const std::basic_string< | (17) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator<=( const std::basic_string< | (18) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator>( const std::basic_string< | (19) | (since C++11) (until C++20) | 
| template< class BidirIt, class Traits, class Alloc > bool operator>=( const std::basic_string< | (20) | (since C++11) (until C++20) | 
| std::sub_matchandstd::iterator_traits<BidirIt>::value_type* | ||
| template< class BidirIt > bool operator==( const std::sub_match<BidirIt>& sm, | (21) | (since C++11) | 
| template< class BidirIt > bool operator!=( const std::sub_match<BidirIt>& sm, | (22) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<( const std::sub_match<BidirIt>& sm, | (23) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<=( const std::sub_match<BidirIt>& sm, | (24) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>( const std::sub_match<BidirIt>& sm, | (25) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>=( const std::sub_match<BidirIt>& sm, | (26) | (since C++11) (until C++20) | 
| template< class BidirIt > /*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& sm, | (27) | (since C++20) | 
| std::iterator_traits<BidirIt>::value_type*andstd::sub_match | ||
| template< class BidirIt > bool operator==( const typename std::iterator_traits<BidirIt>::value_type* s, | (28) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator!=( const typename std::iterator_traits<BidirIt>::value_type* s, | (29) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<( const typename std::iterator_traits<BidirIt>::value_type* s, | (30) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<=( const typename std::iterator_traits<BidirIt>::value_type* s, | (31) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>( const typename std::iterator_traits<BidirIt>::value_type* s, | (32) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>=( const typename std::iterator_traits<BidirIt>::value_type* s, | (33) | (since C++11) (until C++20) | 
| std::sub_matchandstd::iterator_traits<BidirIt>::value_type | ||
| template< class BidirIt > bool operator==( const std::sub_match<BidirIt>& sm, | (34) | (since C++11) | 
| template< class BidirIt > bool operator!=( const std::sub_match<BidirIt>& sm, | (35) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<( const std::sub_match<BidirIt>& sm, | (36) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<=( const std::sub_match<BidirIt>& sm, | (37) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>( const std::sub_match<BidirIt>& sm, | (38) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>=( const std::sub_match<BidirIt>& sm, | (39) | (since C++11) (until C++20) | 
| template< class BidirIt > /*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& sm, | (40) | (since C++20) | 
| std::iterator_traits<BidirIt>::value_typeandstd::sub_match | ||
| template< class BidirIt > bool operator==( const typename std::iterator_traits<BidirIt>::value_type& ch, | (41) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator!=( const typename std::iterator_traits<BidirIt>::value_type& ch, | (42) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<( const typename std::iterator_traits<BidirIt>::value_type& ch, | (43) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator<=( const typename std::iterator_traits<BidirIt>::value_type& ch, | (44) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>( const typename std::iterator_traits<BidirIt>::value_type& ch, | (45) | (since C++11) (until C++20) | 
| template< class BidirIt > bool operator>=( const typename std::iterator_traits<BidirIt>::value_type& ch, | (46) | (since C++11) (until C++20) | 
Compares a sub_match to another sub_match, a string, a null-terminated character sequence or a character.
| The return type of three-way comparison operators (/*comp-cat*/) is std::compare_three_way_result_t<typename std::sub_match<BidirIt>::string_type>>, i.e. std::char_traits<typename std::iterator_traits<BidirIt>::value_type>::comparison_category if that qualified-id is valid and denotes a type, std::weak_ordering otherwise. If /*comp-cat*/ is not a comparison category type, the program is ill-formed. The  | (since C++20) | 
Parameters
| lhs, rhs, sm | - | a sub_matchto compare | 
| st | - | a basic_stringto compare | 
| s | - | a pointer to a null-terminated string to compare | 
| ch | - | a character to compare | 
Return value
For operator==,  (since C++20)true if the corresponding comparison holds as defined by std::sub_match::compare(), false otherwise.
| For  | (since C++20) | 
Notes
| If value type of  | (since C++20) | 
Example
| This section is incomplete Reason: no example | 
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior | 
|---|---|---|---|
| LWG 3432 | C++20 | the return type of operator<=>was not required to be a comparison category type | required | 
See also
| compares matched subsequence (if any) (public member function) |