Move the test for zero-length into the char_traits (from string_view). Add tests to char_traits specializations

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228981 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2015-02-12 23:34:52 +00:00
parent 7f59a88431
commit f2e36ef093
6 changed files with 7 additions and 3 deletions

View File

@@ -375,7 +375,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
_LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
{
size_type __rlen = _VSTD::min( size(), __sv.size());
int __retval = __rlen == 0 ? 0 : _Traits::compare(data(), __sv.data(), __rlen);
int __retval = _Traits::compare(data(), __sv.data(), __rlen);
if ( __retval == 0 ) // first __rlen chars matched
__retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
return __retval;