23 #include <string_view>
29 static constexpr
bool alphanum_isdigit(
const char c) noexcept
31 return c >=
'0' && c <=
'9';
48 static constexpr
int impl(std::string_view ll, std::string_view rr) noexcept
57 const char* l = ll.data();
58 const char* r = rr.data();
59 while(l != ll.end() && r != rr.end() && *l && *r)
63 char l_char{}, r_char{};
64 while((l != ll.end() && r != rr.end()) && (l_char = *l) && (r_char = *r))
67 const bool l_digit = alphanum_isdigit(l_char),
68 r_digit = alphanum_isdigit(r_char);
70 if(l_digit && r_digit)
82 const int diff = l_char - r_char;
94 unsigned long l_int = 0;
95 while(l != ll.end() && *l && alphanum_isdigit(*l))
98 l_int = l_int * 10 + *l -
'0';
103 unsigned long r_int = 0;
104 while(r != rr.end() && *r && alphanum_isdigit(*r))
107 r_int = r_int * 10 + *r -
'0';
112 const long diff = l_int - r_int;
128 constexpr
bool operator()(std::string_view l, std::string_view r)
const noexcept
130 return impl(l.data(), r.data()) < 0;
Definition: Alphanum.hpp:28
static constexpr int impl(std::string_view ll, std::string_view rr) noexcept
Definition: Alphanum.hpp:48