14 int case_compare(const std::string_view str0
, const std::string_view str1
) noexcept
16 using Traits
= std::string_view::traits_type
;
18 auto ch0
= str0
.cbegin();
19 auto ch1
= str1
.cbegin();
20 auto ch1end
= ch1
+ std::min(str0
.size(), str1
.size());
23 const int u0
{std::toupper(Traits::to_int_type(*ch0
))};
24 const int u1
{std::toupper(Traits::to_int_type(*ch1
))};
25 if(const int diff
{u0
-u1
}) return diff
;
29 if(str0
.size() < str1
.size()) return -1;
30 if(str0
.size() > str1
.size()) return 1;
34 int case_compare(const std::wstring_view str0
, const std::wstring_view str1
) noexcept
36 using Traits
= std::wstring_view::traits_type
;
38 auto ch0
= str0
.cbegin();
39 auto ch1
= str1
.cbegin();
40 auto ch1end
= ch1
+ std::min(str0
.size(), str1
.size());
43 const auto u0
= std::towupper(Traits::to_int_type(*ch0
));
44 const auto u1
= std::towupper(Traits::to_int_type(*ch1
));
45 if(const auto diff
= static_cast<int>(u0
-u1
)) return diff
;
49 if(str0
.size() < str1
.size()) return -1;
50 if(str0
.size() > str1
.size()) return 1;