]> ruin.nu Git - popboot.git/commitdiff
simple hash
authorMichael Andreen <harv@ruin.nu>
Wed, 1 Jun 2005 09:09:51 +0000 (09:09 +0000)
committerMichael Andreen <harv@ruin.nu>
Wed, 1 Jun 2005 09:09:51 +0000 (09:09 +0000)
action.h

index 606857d8524ade62545f3455d8984e0dfbe4325a..a0a1173e4cc0ce9ff6507f615e8c911ed529bb7c 100644 (file)
--- a/action.h
+++ b/action.h
@@ -15,9 +15,10 @@ namespace __gnu_cxx {
                struct hash< std::basic_string<CharT, Traits, Alloc> > {
                        size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
 
                struct hash< std::basic_string<CharT, Traits, Alloc> > {
                        size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
 
-                               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 hash = 0;
+                               for (unsigned int i = 0; i < s.size(); ++i)
+                                       hash += static_cast<size_t>(s[i]);
+                               return hash + s.size();
 
                        }
 
 
                        }
 
@@ -28,9 +29,10 @@ namespace __gnu_cxx {
 
                        size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
 
 
                        size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
 
-                               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 hash = 0;
+                               for (unsigned int i = 0; i < s.size(); ++i)
+                                       hash += static_cast<size_t>(s[i]);
+                               return hash + s.size();
                        }
 
                };
                        }
 
                };