[string.view.comparison] (original) (raw)
27 Strings library [strings]
27.3 String view classes [string.view]
27.3.4 Non-member comparison functions [string.view.comparison]
template<class charT, class traits> constexpr bool operator==(basic_string_view<charT, traits> lhs, type_identity_t<basic_string_view<charT, traits>> rhs) noexcept;
Returns: lhs.compare(rhs) == 0.
template<class charT, class traits> constexpr _see below_ operator<=>(basic_string_view<charT, traits> lhs, type_identity_t<basic_string_view<charT, traits>> rhs) noexcept;
Let R denote the type traits::comparison_category if that qualified-id is valid and denotes a type ([temp.deduct]), otherwise R is weak_ordering.
Returns: static_cast<R>(lhs.compare(rhs) <=> 0).
[Note 1:
The usage of type_identity_t as parameter ensures that an object of type basic_string_view<charT, traits>can always be compared with an object of a type T with an implicit conversion to basic_string_view<charT, traits>, and vice versa, as per [over.match.oper].
— _end note_]