@@ -720,16 +720,19 @@ basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>;
720
720
721
721
// [string.view.comparison]
722
722
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 {
728
729
if (__lhs.size () != __rhs.size ())
729
730
return false ;
730
731
return __lhs.compare (__rhs) == 0 ;
731
732
}
732
733
734
+ #if _LIBCPP_STD_VER >= 20
735
+
733
736
template <class _CharT , class _Traits >
734
737
_LIBCPP_HIDE_FROM_ABI constexpr auto operator <=>(basic_string_view<_CharT, _Traits> __lhs,
735
738
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, _
755
758
return __lhs.compare (__rhs) == 0 ;
756
759
}
757
760
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
-
769
761
template <class _CharT , class _Traits , int = 2 >
770
762
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
771
763
operator ==(__type_identity_t <basic_string_view<_CharT, _Traits> > __lhs,
772
764
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;
776
766
}
777
767
778
768
// operator !=
779
769
template <class _CharT , class _Traits >
780
770
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
781
771
operator !=(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);
785
773
}
786
774
787
775
template <class _CharT , class _Traits , int = 1 >
788
776
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
789
777
operator !=(basic_string_view<_CharT, _Traits> __lhs,
790
778
__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);
794
780
}
795
781
796
782
template <class _CharT , class _Traits , int = 2 >
797
783
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool
798
784
operator !=(__type_identity_t <basic_string_view<_CharT, _Traits> > __lhs,
799
785
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);
803
787
}
804
788
805
789
// operator <
0 commit comments