diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-28 11:03:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-28 11:03:57 +0200 |
commit | 6abd3d57f666ce1cd4c4c792e649fd313bee22ad (patch) | |
tree | 031074c92a5ce5a627e3dba8076eb9d10ac006f8 /butl/utility | |
parent | 039f62b48a14fefabae07d8c008e2e131deadfc6 (diff) |
Add case_compare_string, case_compare_c_string comparators
Diffstat (limited to 'butl/utility')
-rw-r--r-- | butl/utility | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/butl/utility b/butl/utility index e2e9b37..cedfc3d 100644 --- a/butl/utility +++ b/butl/utility @@ -60,6 +60,24 @@ namespace butl int casecmp (const char*, const char*, std::size_t = std::string::npos); + // Case-insensitive key comparators (i.e., to be used in sets, maps, etc). + // + struct case_compare_string + { + bool operator() (const std::string& x, const std::string& y) const + { + return casecmp (x, y) < 0; + } + }; + + struct case_compare_c_string + { + bool operator() (const char* x, const char* y) const + { + return casecmp (x, y) < 0; + } + }; + bool alpha (char); |