OSDN Git Service

2011-02-10 Jonathan Wakely <jwakely.gcc@gmail.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / compatibility-c++0x.cc
index abdc72c..08a5727 100644 (file)
@@ -30,7 +30,7 @@
 # error "compatibility-c++0x.cc must be compiled with -std=gnu++0x"
 #endif
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
   // gcc-4.4.0
   // <mutex> exported std::lock_error
@@ -50,13 +50,35 @@ namespace std
   // We need these due to the symbols exported since GLIBCXX_3.4.10.
   // See libstdc++/41662 for details.
 
-#include "hash-string-aux.cc"
+#ifndef _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
+  template<>
+    size_t
+    hash<string>::operator()(string __s) const
+    { return _Hash_impl::hash(__s.data(), __s.length()); }
+
+  template<>
+    size_t
+    hash<const string&>::operator()(const string& __s) const
+    { return _Hash_impl::hash(__s.data(), __s.length()); }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  template<>
+    size_t
+    hash<wstring>::operator()(wstring __s) const
+    { return _Hash_impl::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
+
+  template<>
+    size_t
+    hash<const wstring&>::operator()(const wstring& __s) const
+    { return _Hash_impl::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
+#endif
+#endif
 
   template<>
     size_t
     hash<error_code>::operator()(error_code __e) const
-    { 
-      const char* __p = reinterpret_cast<const char*>(&__e);
-      return _Fnv_hash<>::hash(__p, sizeof(__e));
+    {
+      const size_t __tmp = std::_Hash_impl::hash(__e._M_value);
+      return std::_Hash_impl::__hash_combine(__e._M_cat, __tmp);
     }
 }