|
@@ -3392,7 +3392,17 @@ _LIBCPP_INLINE_VISIBILITY inline
|
|
int
|
|
int
|
|
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
|
|
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
|
|
{
|
|
{
|
|
- return compare(0, npos, __str.data(), __str.size());
|
|
|
|
|
|
+ size_t __lhs_sz = size();
|
|
|
|
+ size_t __rhs_sz = __str.size();
|
|
|
|
+ int __result = traits_type::compare(data(), __str.data(),
|
|
|
|
+ _VSTD::min(__lhs_sz, __rhs_sz));
|
|
|
|
+ if (__result != 0)
|
|
|
|
+ return __result;
|
|
|
|
+ if (__lhs_sz < __rhs_sz)
|
|
|
|
+ return -1;
|
|
|
|
+ if (__lhs_sz > __rhs_sz)
|
|
|
|
+ return 1;
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
template <class _CharT, class _Traits, class _Allocator>
|
|
template <class _CharT, class _Traits, class _Allocator>
|