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