operator==,!=,<,<=,>,>=,<=>(std::sub_match)
Header: <regex>
Compares a sub_match to another sub_match, a std::string, a C-style string or a single character.
# Declarations
Direct comparison
template< class BidirIt >
bool operator== ( const std::sub_match<BidirIt>& lhs,
const std::sub_match<BidirIt>& rhs );
(since C++11)
template< class BidirIt >
bool operator!= ( const std::sub_match<BidirIt>& lhs,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator< ( const std::sub_match<BidirIt>& lhs,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator<= ( const std::sub_match<BidirIt>& lhs,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator> ( const std::sub_match<BidirIt>& lhs,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator>= ( const std::sub_match<BidirIt>& lhs,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
auto operator<=>( const std::sub_match<BidirIt>& lhs,
const std::sub_match<BidirIt>& rhs );
(since C++20)
Comparing with a std::basic_string
template< class BidirIt, class Traits, class Alloc >
bool operator== ( const std::sub_match<BidirIt>& lhs,
const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str );
(since C++11)
template< class BidirIt, class Traits, class Alloc >
bool operator!= ( const std::sub_match<BidirIt>& lhs,
const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator< ( const std::sub_match<BidirIt>& lhs,
const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator<= ( const std::sub_match<BidirIt>& lhs,
const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator> ( const std::sub_match<BidirIt>& lhs,
const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator>= ( const std::sub_match<BidirIt>& lhs,
const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
auto operator<=>( const std::sub_match<BidirIt>& lhs,
const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str );
(since C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator== ( const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator!= ( const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator< ( const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator<= ( const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator> ( const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator>= ( const std::basic_string</*value-type-of*/<BidirIt>,
Traits, Alloc>& str,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
Comparing with a C-style string
template< class BidirIt >
bool operator== ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>* s );
(since C++11)
template< class BidirIt >
bool operator!= ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>* s );
(since C++11) (until C++20)
template< class BidirIt >
bool operator< ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>* s );
(since C++11) (until C++20)
template< class BidirIt >
bool operator<= ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>* s );
(since C++11) (until C++20)
template< class BidirIt >
bool operator> ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>* s );
(since C++11) (until C++20)
template< class BidirIt >
bool operator>= ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>* s );
(since C++11) (until C++20)
template< class BidirIt >
auto operator<=>( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>* s );
(since C++20)
template< class BidirIt >
bool operator== ( const /*value-type-of*/<BidirIt>* s,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator!= ( const /*value-type-of*/<BidirIt>* s,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator< ( const /*value-type-of*/<BidirIt>* s,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator<= ( const /*value-type-of*/<BidirIt>* s,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator> ( const /*value-type-of*/<BidirIt>* s,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator>= ( const /*value-type-of*/<BidirIt>* s,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
Comparing with a single character
template< class BidirIt >
bool operator== ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>& ch );
(since C++11)
template< class BidirIt >
bool operator!= ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>& ch );
(since C++11) (until C++20)
template< class BidirIt >
bool operator< ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>& ch );
(since C++11) (until C++20)
template< class BidirIt >
bool operator<= ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>& ch );
(since C++11) (until C++20)
template< class BidirIt >
bool operator> ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>& ch );
(since C++11) (until C++20)
template< class BidirIt >
bool operator>= ( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>& ch );
(since C++11) (until C++20)
template< class BidirIt >
auto operator<=>( const std::sub_match<BidirIt>& lhs,
const /*value-type-of*/<BidirIt>& ch );
(since C++20)
template< class BidirIt >
bool operator== ( const /*value-type-of*/<BidirIt>& ch,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator!= ( const /*value-type-of*/<BidirIt>& ch,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator< ( const /*value-type-of*/<BidirIt>& ch,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator<= ( const /*value-type-of*/<BidirIt>& ch,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator> ( const /*value-type-of*/<BidirIt>& ch,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
template< class BidirIt >
bool operator>= ( const /*value-type-of*/<BidirIt>& ch,
const std::sub_match<BidirIt>& rhs );
(since C++11) (until C++20)
Helper type aliases
template< class BidirIt >
using /*value-type-of*/ =
typename std::iterator_traits<BidirIt>::value_type;
(exposition only*)
template< class BidirIt >
using /*cat-type-of*/ =
std::compare_three_way_result_t
<std::basic_string</*value-type-of*/<BidirIt>>>;
(since C++20) (exposition only*)
# Parameters
lhs, rhs: a sub_match to comparestr: a std::basic_string to compares: a pointer to a C-style string to comparech: a character to compare
# Return value
Let target be the following values:
# Notes
The return type of operator<=> is guaranteed to be a comparison category type. If value-type-of
# Example
This section is incompleteReason: no example
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2217 | C++11 | for comparisons with std::string, theargument of compare() was str.c_str() | the argument isstring_type(str.data(), str.size())) |