@@ -722,16 +722,19 @@ basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>;
722722
723723// [string.view.comparison]
724724
725- # if _LIBCPP_STD_VER >= 20
726-
727- template <class _CharT , class _Traits >
728- _LIBCPP_HIDE_FROM_ABI constexpr bool operator ==(basic_string_view<_CharT, _Traits> __lhs,
729- type_identity_t <basic_string_view<_CharT, _Traits>> __rhs) noexcept {
725+ // The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409326 for details.
726+ // This applies to the other sufficient overloads below for the other comparison operators.
727+ template <class _CharT , class _Traits , int = 1 >
728+ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
729+ operator ==(basic_string_view<_CharT, _Traits> __lhs,
730+ __type_identity_t <basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
730731 if (__lhs.size () != __rhs.size ())
731732 return false ;
732733 return __lhs.compare (__rhs) == 0 ;
733734}
734735
736+ # if _LIBCPP_STD_VER >= 20
737+
735738template <class _CharT , class _Traits >
736739_LIBCPP_HIDE_FROM_ABI constexpr auto operator <=>(basic_string_view<_CharT, _Traits> __lhs,
737740 type_identity_t <basic_string_view<_CharT, _Traits>> __rhs) noexcept {
@@ -757,51 +760,32 @@ operator==(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _
757760 return __lhs.compare (__rhs) == 0 ;
758761}
759762
760- // The dummy default template parameters are used to work around a MSVC issue with mangling, see VSO-409326 for details.
761- // This applies to the other sufficient overloads below for the other comparison operators.
762- template <class _CharT , class _Traits , int = 1 >
763- _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
764- operator ==(basic_string_view<_CharT, _Traits> __lhs,
765- __type_identity_t <basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
766- if (__lhs.size () != __rhs.size ())
767- return false ;
768- return __lhs.compare (__rhs) == 0 ;
769- }
770-
771763template <class _CharT , class _Traits , int = 2 >
772764_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
773765operator ==(__type_identity_t <basic_string_view<_CharT, _Traits> > __lhs,
774766 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
775- if (__lhs.size () != __rhs.size ())
776- return false ;
777- return __lhs.compare (__rhs) == 0 ;
767+ return __lhs == __rhs;
778768}
779769
780770// operator !=
781771template <class _CharT , class _Traits >
782772_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
783773operator !=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
784- if (__lhs.size () != __rhs.size ())
785- return true ;
786- return __lhs.compare (__rhs) != 0 ;
774+ return !(__lhs == __rhs);
787775}
788776
789777template <class _CharT , class _Traits , int = 1 >
790778_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
791779operator !=(basic_string_view<_CharT, _Traits> __lhs,
792780 __type_identity_t <basic_string_view<_CharT, _Traits> > __rhs) _NOEXCEPT {
793- if (__lhs.size () != __rhs.size ())
794- return true ;
795- return __lhs.compare (__rhs) != 0 ;
781+ return !(__lhs == __rhs);
796782}
797783
798784template <class _CharT , class _Traits , int = 2 >
799785_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
800786operator !=(__type_identity_t <basic_string_view<_CharT, _Traits> > __lhs,
801787 basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT {
802- if (__lhs.size () != __rhs.size ())
803- return true ;
804- return __lhs.compare (__rhs) != 0 ;
788+ return !(__lhs == __rhs);
805789}
806790
807791// operator <
0 commit comments