@@ -310,6 +310,12 @@ template <std::ranges::contiguous_range R>
310310basic_string_view(R&&) -> basic_string_view<std::ranges::range_value_t<R>>;
311311
312312// [string.view.comparison], non-member comparison functions
313+ template <typename CharT, typename Traits>
314+ constexpr bool operator==(basic_string_view<CharT, Traits> lhs, std::basic_string_view<CharT, Traits> rhs) noexcept {
315+ // this is a better match for comparisons of rsl::string_view to std::string_view, it disambiguates
316+ return std::string_view(lhs) == rhs;
317+ }
318+
313319template <typename CharT, typename Traits>
314320constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
315321 std::type_identity_t<basic_string_view<CharT, Traits>> rhs) noexcept {
@@ -319,6 +325,13 @@ constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
319325 return lhs.compare(rhs) == 0;
320326}
321327
328+ template <typename CharT, typename Traits>
329+ constexpr auto operator<=>(basic_string_view<CharT, Traits> lhs,
330+ std::basic_string_view<CharT, Traits> rhs) noexcept {
331+ // better match for comparisons between rsl::string_view and std::string_view
332+ return std::string_view(lhs) <=> rhs;
333+ }
334+
322335template <typename CharT, typename Traits>
323336constexpr auto operator<=>(basic_string_view<CharT, Traits> lhs,
324337 std::type_identity_t<basic_string_view<CharT, Traits>> rhs) noexcept {
0 commit comments