https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90388
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Alternative patch:
operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x)
{ return !(nullptr < __x); }
- /// std::hash specialization for unique_ptr.
- template<typename _Tp, typename _Dp>
- struct hash<unique_ptr<_Tp, _Dp>>
- : public __hash_base<size_t, unique_ptr<_Tp, _Dp>>,
- private __poison_hash<typename unique_ptr<_Tp, _Dp>::pointer>
+ template<typename _Up, typename _Ptr = typename _Up::pointer,
+ bool = __poison_hash<_Ptr>::__enable_hash_call>
+ struct __uniq_ptr_hash
{
size_t
- operator()(const unique_ptr<_Tp, _Dp>& __u) const noexcept
+ operator()(const _Up& __u) const
+ noexcept(noexcept(std::declval<hash<_Ptr>&>()(std::declval<_Ptr>())))
{
- typedef unique_ptr<_Tp, _Dp> _UP;
- return std::hash<typename _UP::pointer>()(__u.get());
+ return hash<_Ptr>()(__u.get());
}
};
+ template<typename _Up, typename _Ptr>
+ struct __uniq_ptr_hash<_Up, _Ptr, false>
+ : private __poison_hash<_Ptr>
+ { };
+
+ /// std::hash specialization for unique_ptr.
+ template<typename _Tp, typename _Dp>
+ struct hash<unique_ptr<_Tp, _Dp>>
+ : public __hash_base<size_t, unique_ptr<_Tp, _Dp>>,
+ public __uniq_ptr_hash<unique_ptr<_Tp, _Dp>>
+ { };
+
#if __cplusplus > 201103L
#define __cpp_lib_make_unique 201304