Crow/include/ci_map.h

35 lines
732 B
C
Raw Normal View History

#pragma once
2014-10-23 19:17:20 +00:00
#include <boost/algorithm/string/predicate.hpp>
#include <boost/functional/hash.hpp>
2014-10-23 19:17:20 +00:00
#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>;
}