#include <vector>
#include <string>
#include <ext/hash_map>
+#include <locale>
typedef std::vector<std::string> Literals;
typedef __gnu_cxx::hash_map<std::string,bool> Preconditions;
struct hash< std::basic_string<CharT, Traits, Alloc> > {
size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
- size_t hash = 0;
- for (unsigned int i = 0; i < s.size(); ++i)
- hash += static_cast<size_t>(s[i]);
- return hash + s.size();
+ const std::collate<CharT>& c = std::use_facet< std::collate<CharT> >(std::locale());
+
+ return c.hash(s.c_str(), s.c_str() + s.size());
}
size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
- size_t hash = 0;
- for (unsigned int i = 0; i < s.size(); ++i)
- hash += static_cast<size_t>(s[i]);
- return hash + s.size();
+ const std::collate<CharT>& c = std::use_facet< std::collate<CharT> >(std::locale());
+
+ return c.hash(s.c_str(), s.c_str() + s.size());
}
};