diff options
| author | 2026-03-02 17:44:34 +0000 | |
|---|---|---|
| committer | 2026-03-02 17:49:05 +0000 | |
| commit | 2d20b16ce636dffcc68b5e6998bfa9e3c818f241 (patch) | |
| tree | 11cfbb12098cde67dc9c883d540d94134b740d7d /src/hashcomp.cpp | |
| parent | Move the event/ prefix of events to the parent class. (diff) | |
Add irc::less and convert irc::insensitive_swo to use it.
Diffstat (limited to 'src/hashcomp.cpp')
| -rw-r--r-- | src/hashcomp.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 2c4985173..02a0eaa04 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -134,13 +134,10 @@ size_t irc::find(const std::string_view& haystack, const std::string_view& needl return std::string::npos; } -bool irc::insensitive_swo::operator()(const std::string& a, const std::string& b) const +bool irc::less(const std::string_view& a, const std::string_view& b) { - std::string::size_type asize = a.size(); - std::string::size_type bsize = b.size(); - std::string::size_type maxsize = std::min(asize, bsize); - - for (std::string::size_type i = 0; i < maxsize; i++) + const auto maxsize = std::min(a.size(), b.size()); + for (std::string_view::size_type i = 0; i < maxsize; i++) { unsigned char A = national_case_insensitive_map[static_cast<unsigned char>(a[i])]; unsigned char B = national_case_insensitive_map[static_cast<unsigned char>(b[i])]; @@ -149,7 +146,7 @@ bool irc::insensitive_swo::operator()(const std::string& a, const std::string& b else if (A < B) return true; } - return (asize < bsize); + return a.size() < b.size(); } size_t irc::insensitive::operator()(const std::string& s) const |
