diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-11-12 03:24:34 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2016-11-12 03:24:34 +0000 |
commit | 0f88f1f2ab86b2e0f07996d4d1ab10a225264377 (patch) | |
tree | b632a7ef3817527dcb16a707e6cbb01821d82df2 /libstdc++-v3 | |
parent | 9eb97e61d8f26c502f12de2fb12e9eeb9ac0895b (diff) | |
download | gcc-0f88f1f2ab86b2e0f07996d4d1ab10a225264377.zip gcc-0f88f1f2ab86b2e0f07996d4d1ab10a225264377.tar.gz gcc-0f88f1f2ab86b2e0f07996d4d1ab10a225264377.tar.bz2 |
Use shared_ptr<T>::element_type in hash specializations
* 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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/shared_ptr.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/shared_ptr_base.h | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e1a4764..f8eb55d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -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. diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h index 9f7a40c..e562a42 100644 --- a/libstdc++-v3/include/bits/shared_ptr.h +++ b/libstdc++-v3/include/bits/shared_ptr.h @@ -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 diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 1a9e3e9..5e344b8 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -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 |