@@ -720,16 +720,19 @@ basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>;
720720
721721// [string.view.comparison]
722722
723- #if _LIBCPP_STD_VER >= 20
724-
725- template <class _CharT , class _Traits >
726- _LIBCPP_HIDE_FROM_ABI constexpr bool operator ==(basic_string_view<_CharT, _Traits> __lhs,
727- type_identity_t <basic_string_view<_CharT, _Traits>> __rhs) noexcept {
723+ // The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409326 for details.
724+ // This applies to the other sufficient overloads below for the other comparison operators.
725+ template <class _CharT , class _Traits , int = 1 >
726+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
727+ operator ==(basic_string_view<_CharT, _Traits> __lhs,
728+ __type_identity_t <basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
728729 if (__lhs.size () != __rhs.size ())
729730 return false ;
730731 return __lhs.compare (__rhs) == 0 ;
731732}
732733
734+ #if _LIBCPP_STD_VER >= 20
735+
733736template <class _CharT , class _Traits >
734737_LIBCPP_HIDE_FROM_ABI constexpr auto operator <=>(basic_string_view<_CharT, _Traits> __lhs,
735738 type_identity_t <basic_string_view<_CharT, _Traits>> __rhs) noexcept {
@@ -755,51 +758,32 @@ operator==(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _
755758 return __lhs.compare (__rhs) == 0 ;
756759}
757760
758- // The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409326 for details.
759- // This applies to the other sufficient overloads below for the other comparison operators.
760- template <class _CharT , class _Traits , int = 1 >
761- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
762- operator ==(basic_string_view<_CharT, _Traits> __lhs,
763- __type_identity_t <basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
764- if (__lhs.size () != __rhs.size ())
765- return false ;
766- return __lhs.compare (__rhs) == 0 ;
767- }
768-
769761template <class _CharT , class _Traits , int = 2 >
770762_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
771763operator ==(__type_identity_t <basic_string_view<_CharT, _Traits> > __lhs,
772764 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
773- if (__lhs.size () != __rhs.size ())
774- return false ;
775- return __lhs.compare (__rhs) == 0 ;
765+ return __lhs == __rhs;
776766}
777767
778768// operator !=
779769template <class _CharT , class _Traits >
780770_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
781771operator !=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
782- if (__lhs.size () != __rhs.size ())
783- return true ;
784- return __lhs.compare (__rhs) != 0 ;
772+ return !(__lhs == __rhs);
785773}
786774
787775template <class _CharT , class _Traits , int = 1 >
788776_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
789777operator !=(basic_string_view<_CharT, _Traits> __lhs,
790778 __type_identity_t <basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
791- if (__lhs.size () != __rhs.size ())
792- return true ;
793- return __lhs.compare (__rhs) != 0 ;
779+ return !(__lhs == __rhs);
794780}
795781
796782template <class _CharT , class _Traits , int = 2 >
797783_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
798784operator !=(__type_identity_t <basic_string_view<_CharT, _Traits> > __lhs,
799785 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
800- if (__lhs.size () != __rhs.size ())
801- return true ;
802- return __lhs.compare (__rhs) != 0 ;
786+ return !(__lhs == __rhs);
803787}
804788
805789// operator <
0 commit comments