diff --git a/src/string_func.h b/src/string_func.h index 192ed6a8fb..06ca838cd1 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -60,6 +60,11 @@ void StrTrimInPlace(std::string &str); [[nodiscard]] bool StrEqualsIgnoreCase(const std::string_view str1, const std::string_view str2); [[nodiscard]] int StrNaturalCompare(std::string_view s1, std::string_view s2, bool ignore_garbage_at_front = false); +/** Case insensitive comparator for strings, for example for use in std::map. */ +struct CaseInsensitiveComparator { + bool operator()(const std::string_view s1, const std::string_view s2) const { return StrCompareIgnoreCase(s1, s2) < 0; } +}; + /** * Check if a string buffer is empty. *