Spec-Zone.ru › C++

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

Определено в заголовке <regex>
Прямое сравнение
template< class BidirIt >
bool operator==( const std::sub_match<BidirIt>& lhs, 
                 const std::sub_match<BidirIt>& rhs );
(1) (с C++11)
template< class BidirIt >
bool operator!=( const std::sub_match<BidirIt>& lhs, 
                 const std::sub_match<BidirIt>& rhs );
(2) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<( const std::sub_match<BidirIt>& lhs, 
                const std::sub_match<BidirIt>& rhs );
(3) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<=( const std::sub_match<BidirIt>& lhs, 
                 const std::sub_match<BidirIt>& rhs );
(4) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>( const std::sub_match<BidirIt>& lhs, 
                const std::sub_match<BidirIt>& rhs );
(5) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>=( const std::sub_match<BidirIt>& lhs, 
                 const std::sub_match<BidirIt>& rhs );
(6) (с C++11)
(до C++20)
template< class BidirIt >
/*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& lhs, 
                          const std::sub_match<BidirIt>& rhs );
(7) (с C++20)
std::sub_match и std::basic_string
template< class BidirIt, class Traits, class Alloc >
bool operator==( const std::sub_match<BidirIt>& sm,
                 const std::basic_string<
                     typename std::iterator_traits<BidirIt>::value_type,
                     Traits,Alloc>& rhs );
(8) (с C++11)
template< class BidirIt, class Traits, class Alloc >
bool operator!=( const std::sub_match<BidirIt>& sm,
                 const std::basic_string<
                     typename std::iterator_traits<BidirIt>::value_type,
                     Traits,Alloc>& st );
(9) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator<( const std::sub_match<BidirIt>& sm,
                const std::basic_string<
                    typename std::iterator_traits<BidirIt>::value_type,
                    Traits,Alloc>& st );
(10) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator<=( const std::sub_match<BidirIt>& sm,
                 const std::basic_string<
                     typename std::iterator_traits<BidirIt>::value_type,
                     Traits,Alloc>& st );
(11) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator>( const std::sub_match<BidirIt>& sm,
                const std::basic_string<
                    typename std::iterator_traits<BidirIt>::value_type,
                    Traits,Alloc>& st );
(12) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator>=( const std::sub_match<BidirIt>& sm,
                 const std::basic_string<
                     typename std::iterator_traits<BidirIt>::value_type,
                     Traits,Alloc>& st );
(13) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
/*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& sm, 
                          const std::basic_string<
                              typename std::iterator_traits<BidirIt>::value_type,
                              Traits,Alloc>& st );
(14) (с C++20)
std::basic_string и 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>& st,
                 const std::sub_match<BidirIt>& sm );
(15) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator!=( const std::basic_string<
                     typename std::iterator_traits<BidirIt>::value_type,
                     Traits,Alloc>& st,
                 const std::sub_match<BidirIt>& sm );
(16) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator<( const std::basic_string<
                    typename std::iterator_traits<BidirIt>::value_type,
                    Traits,Alloc>& st,
                const std::sub_match<BidirIt>& sm );
(17) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator<=( const std::basic_string<
                    typename std::iterator_traits<BidirIt>::value_type,
                    Traits,Alloc>& st,
                const std::sub_match<BidirIt>& sm );
(18) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator>( const std::basic_string<
                    typename std::iterator_traits<BidirIt>::value_type,
                    Traits,Alloc>& st,
                const std::sub_match<BidirIt>& sm );
(19) (с C++11)
(до C++20)
template< class BidirIt, class Traits, class Alloc >
bool operator>=( const std::basic_string<
                     typename std::iterator_traits<BidirIt>::value_type,
                     Traits,Alloc>& st,
                 const std::sub_match<BidirIt>& sm );
(20) (с C++11)
(до C++20)
std::sub_match и std::iterator_traits<BidirIt>::value_type*
template< class BidirIt >
bool operator==( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type* s );
(21) (с C++11)
template< class BidirIt >
bool operator!=( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type* s );
(22) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<( const std::sub_match<BidirIt>& sm,
                const typename std::iterator_traits<BidirIt>::value_type* s );
(23) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<=( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type* s );
(24) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>( const std::sub_match<BidirIt>& sm,
                const typename std::iterator_traits<BidirIt>::value_type* s );
(25) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>=( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type* s );
(26) (с C++11)
(до C++20)
template< class BidirIt >
/*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& sm,
                          const typename std::iterator_traits<BidirIt>::value_type* s );
(27) (с C++20)
std::iterator_traits<BidirIt>::value_type* и std::sub_match
template< class BidirIt >
bool operator==( const typename std::iterator_traits<BidirIt>::value_type* s,
                 const std::sub_match<BidirIt>& sm );
(28) (с C++11)
(до C++20)
template< class BidirIt >
bool operator!=( const typename std::iterator_traits<BidirIt>::value_type* s,
                 const std::sub_match<BidirIt>& sm );
(29) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<( const typename std::iterator_traits<BidirIt>::value_type* s,
                const std::sub_match<BidirIt>& sm );
(30) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<=( const typename std::iterator_traits<BidirIt>::value_type* s,
                 const std::sub_match<BidirIt>& sm );
(31) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>( const typename std::iterator_traits<BidirIt>::value_type* s,
                const std::sub_match<BidirIt>& sm );
(32) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>=( const typename std::iterator_traits<BidirIt>::value_type* s,
                 const std::sub_match<BidirIt>& sm );
(33) (с C++11)
(до C++20)
std::sub_match и std::iterator_traits<BidirIt>::value_type
template< class BidirIt >
bool operator==( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type& ch );
(34) (с C++11)
template< class BidirIt >
bool operator!=( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type& ch );
(35) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<( const std::sub_match<BidirIt>& sm,
                const typename std::iterator_traits<BidirIt>::value_type& ch );
(36) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<=( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type& ch );
(37) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>( const std::sub_match<BidirIt>& sm,
                const typename std::iterator_traits<BidirIt>::value_type& ch );
(38) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>=( const std::sub_match<BidirIt>& sm,
                 const typename std::iterator_traits<BidirIt>::value_type& ch );
(39) (с C++11)
(до C++20)
template< class BidirIt >
/*comp-cat*/ operator<=>( const std::sub_match<BidirIt>& sm,
                          const typename std::iterator_traits<BidirIt>::value_type& ch );
(40) (с C++20)
std::iterator_traits<BidirIt>::value_type и std::sub_match
template< class BidirIt >
bool operator==( const typename std::iterator_traits<BidirIt>::value_type& ch,
                 const std::sub_match<BidirIt>& sm );
(41) (с C++11)
(до C++20)
template< class BidirIt >
bool operator!=( const typename std::iterator_traits<BidirIt>::value_type& ch,
                 const std::sub_match<BidirIt>& sm );
(42) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<( const typename std::iterator_traits<BidirIt>::value_type& ch,
                const std::sub_match<BidirIt>& sm );
(43) (с C++11)
(до C++20)
template< class BidirIt >
bool operator<=( const typename std::iterator_traits<BidirIt>::value_type& ch,
                 const std::sub_match<BidirIt>& sm );
(44) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>( const typename std::iterator_traits<BidirIt>::value_type& ch,
                const std::sub_match<BidirIt>& sm );
(45) (с C++11)
(до C++20)
template< class BidirIt >
bool operator>=( const typename std::iterator_traits<BidirIt>::value_type& ch,
                 const std::sub_match<BidirIt>& sm );
(46) (с C++11)
(до C++20)

Сравнивает sub_match с другой sub_match, строкой, последовательностью символов с нулевым завершением или символом.

1-7) Сравнивает две sub_match напрямую, сравнивая их лежащие в основе последовательности символов. Реализовано так, как если бы это делалось через lhs.compare(rhs).
END_OF_DOCUMENT_MARKER
8-20) Сравнивает sub_match с std::basic_string. Реализовано как если бы это делал sm.compare(typename sub_match<BidirIt>::string_type(st.data(), st.size()).
21-33) Сравнивает sub_match с строкой с нулевым завершением. Реализовано как если бы это делал sm.compare(s).
34-46) Сравнивает sub_match с символом. Реализовано как если бы это делал sm.compare(typename sub_match<BidirIt>::string_type(1, ch)).

Тип возвращаемого значения операторов трехстороннего сравнения (/*comp-cat*/) — std::compare_three_way_result_t<typename std::sub_match<BidirIt>::string_type>>, т. е. std::char_traits<typename std::iterator_traits<BidirIt>::value_type>::comparison_category в случае, если этот квалифицированный идентификатор является допустимым и обозначает тип, std::weak_ordering в противном случае. Если /*comp-cat*/ не является типом категории сравнения, программа имеет ошибку.

Операторы <, <=, >, >=, и != синтезируются из оператора <=> и оператора == соответственно.

(с C++20)

Параметры

lhs, rhs, sm - сравниваемое sub_match
st - сравниваемое basic_string
s - указатель на строку с нулевым завершением для сравнения
ch - сравниваемый символ

Значение результата

Для operator==, (с C++20)true если соответствующее сравнение выполняется, как определено в std::sub_match::compare(), false в противном случае.

Для operator<=>, static_cast</*comp-cat*/>(/*comp-res*/ <=> 0), где /*comp-res*/ — результат std::sub_match::compare() описанного выше.

(с C++20)

Примечания

Если тип значения BidirIt — char, wchar_t, char8_t, char16_t, или char32_t, тип возвращаемого значения operator<=> — std::strong_ordering.

(с C++20)

Пример

Отчеты об ошибках

Следующие отчеты об ошибках, изменяющие поведение, были применены ретроактивно к ранее опубликованным стандартам C++.

DR Применимо к Поведение, как опубликовано Корректное поведение
LWG 3432 C++20 тип возвращаемого значения operator<=> не должен был быть типом категории сравнения необходимый

См. также

compare
сравнивает соответствующие подпоследовательности (если таковые имеются)
(публичный член-функция)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/regex/sub_match/operator_cmp

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API