diff options
author | ipknHama <ipknhama@gmail.com> | 2016-09-21 23:11:06 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2016-09-21 23:11:06 +0900 |
commit | 3081e4e1a82a4efd8feff68850c4cc04af230cd7 (patch) | |
tree | 3ad16ef2e940abd2d47c4ac3ca224365387b7f37 /include/crow/ci_map.h | |
parent | 8b04940d2f28290451db439ad29155a0b8771ba3 (diff) | |
download | crow-3081e4e1a82a4efd8feff68850c4cc04af230cd7.tar.gz crow-3081e4e1a82a4efd8feff68850c4cc04af230cd7.zip |
Cleanup include folder into crow subfolder
- only crow.h is exposed now
Diffstat (limited to 'include/crow/ci_map.h')
-rw-r--r-- | include/crow/ci_map.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/crow/ci_map.h b/include/crow/ci_map.h new file mode 100644 index 0000000..155d54f --- /dev/null +++ b/include/crow/ci_map.h @@ -0,0 +1,34 @@ +#pragma once + +#include <boost/algorithm/string/predicate.hpp> +#include <boost/functional/hash.hpp> +#include <unordered_map> + +namespace crow +{ + struct ci_hash + { + size_t operator()(const std::string& key) const + { + std::size_t seed = 0; + std::locale locale; + + for(auto c : key) + { + boost::hash_combine(seed, std::toupper(c, locale)); + } + + return seed; + } + }; + + struct ci_key_eq + { + bool operator()(const std::string& l, const std::string& r) const + { + return boost::iequals(l, r); + } + }; + + using ci_map = std::unordered_multimap<std::string, std::string, ci_hash, ci_key_eq>; +} |