Use shared_ptr<T>::element_type in hash specializations
authorJonathan Wakely <jwakely@redhat.com>
Sat, 12 Nov 2016 03:24:34 +0000 (03:24 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sat, 12 Nov 2016 03:24:34 +0000 (03:24 +0000)
* include/bits/shared_ptr.h (hash<shared_ptr<T>>): Use element_type.
* include/bits/shared_ptr_base.h (hash<__shared_ptr<T, L>>): Likewise.

From-SVN: r242333

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/shared_ptr.h
libstdc++-v3/include/bits/shared_ptr_base.h

index e1a4764afd7ac42e3a2843fe1102621b630013a7..f8eb55db79f7234f76c836ad04da5ee4a94770cc 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-11  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/bits/shared_ptr.h (hash<shared_ptr<T>>): Use element_type.
+       * include/bits/shared_ptr_base.h (hash<__shared_ptr<T, L>>): Likewise.
+
 2016-11-10  François Dumont  <fdumont@gcc.gnu.org>
 
        * src/c++11/debug.cc (format_word): Delete.
index 9f7a40c5e1ed17b0b6a5fb0fd660c26a9e82552e..e562a42b33927faa391dcf2ba7634b1bc496697b 100644 (file)
@@ -692,7 +692,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       size_t
       operator()(const shared_ptr<_Tp>& __s) const noexcept
-      { return std::hash<_Tp*>()(__s.get()); }
+      {
+       return std::hash<typename shared_ptr<_Tp>::element_type*>()(__s.get());
+      }
     };
 
   // @} group pointer_abstractions
index 1a9e3e901e97f3ceda6b5d3cbf0dbd688e4ae958..5e344b8e090b4dad2cfc19f10617ef62e67a4ec8 100644 (file)
@@ -1681,7 +1681,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       size_t
       operator()(const __shared_ptr<_Tp, _Lp>& __s) const noexcept
-      { return std::hash<_Tp*>()(__s.get()); }
+      {
+       return hash<typename __shared_ptr<_Tp, _Lp>::element_type*>()(
+           __s.get());
+      }
     };
 
 _GLIBCXX_END_NAMESPACE_VERSION