Electroneum
ci_map.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/algorithm/string/predicate.hpp>
4 #include <boost/functional/hash.hpp>
5 #include <unordered_map>
6 
7 namespace crow
8 {
9  struct ci_hash
10  {
11  size_t operator()(const std::string& key) const
12  {
13  std::size_t seed = 0;
14  std::locale locale;
15 
16  for(auto c : key)
17  {
18  boost::hash_combine(seed, std::toupper(c, locale));
19  }
20 
21  return seed;
22  }
23  };
24 
25  struct ci_key_eq
26  {
27  bool operator()(const std::string& l, const std::string& r) const
28  {
29  return boost::iequals(l, r);
30  }
31  };
32 
33  using ci_map = std::unordered_multimap<std::string, std::string, ci_hash, ci_key_eq>;
34 }
bool operator()(const std::string &l, const std::string &r) const
Definition: ci_map.h:27
Definition: ci_map.h:25
size_t operator()(const std::string &key) const
Definition: ci_map.h:11
int l
Definition: base.py:3
std::unordered_multimap< std::string, std::string, ci_hash, ci_key_eq > ci_map
Definition: ci_map.h:33
Definition: ci_map.h:7
Definition: ci_map.h:9