Deprecate nested types in std::hash
* include/bits/c++config (_GLIBCXX17_DEPRECATED): Define. * include/bits/functional_hash.h (__hash_base::result_type) (__hash_base::argument_type): Add _GLIBCXX17_DEPRECATED. * include/std/optional (hash<optional<T>>::result_type) (hash<optional<T>>::argument_type): Add deprecated attribute. (__is_fast_hash<hash<optional<T>>>): Add partial specialization. * include/std/variant (hash<variant<Types...>>::result_type) (hash<variant<Types...>>::argument_type): Add deprecated attribute. (__is_fast_hash<hash<variant<Types...>>>): Add partial specialization. From-SVN: r253017
This commit is contained in:
parent
7ba0b15a7e
commit
f78958c9b4
|
@ -1,5 +1,15 @@
|
|||
2017-09-20 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
* include/bits/c++config (_GLIBCXX17_DEPRECATED): Define.
|
||||
* include/bits/functional_hash.h (__hash_base::result_type)
|
||||
(__hash_base::argument_type): Add _GLIBCXX17_DEPRECATED.
|
||||
* include/std/optional (hash<optional<T>>::result_type)
|
||||
(hash<optional<T>>::argument_type): Add deprecated attribute.
|
||||
(__is_fast_hash<hash<optional<T>>>): Add partial specialization.
|
||||
* include/std/variant (hash<variant<Types...>>::result_type)
|
||||
(hash<variant<Types...>>::argument_type): Add deprecated attribute.
|
||||
(__is_fast_hash<hash<variant<Types...>>>): Add partial specialization.
|
||||
|
||||
* libsupc++/exception_ptr.h (copy_exception): Remove deprecated
|
||||
non-standard function.
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
// Macros for deprecated attributes.
|
||||
// _GLIBCXX_USE_DEPRECATED
|
||||
// _GLIBCXX_DEPRECATED
|
||||
// _GLIBCXX17_DEPRECATED
|
||||
#ifndef _GLIBCXX_USE_DEPRECATED
|
||||
# define _GLIBCXX_USE_DEPRECATED 1
|
||||
#endif
|
||||
|
@ -87,6 +88,12 @@
|
|||
# define _GLIBCXX_DEPRECATED
|
||||
#endif
|
||||
|
||||
#if defined(__DEPRECATED) && (__cplusplus >= 201703L)
|
||||
# define _GLIBCXX17_DEPRECATED [[__deprecated__]]
|
||||
#else
|
||||
# define _GLIBCXX17_DEPRECATED
|
||||
#endif
|
||||
|
||||
// Macros for ABI tag attributes.
|
||||
#ifndef _GLIBCXX_ABI_TAG_CXX11
|
||||
# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
|
||||
|
|
|
@ -49,8 +49,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Result, typename _Arg>
|
||||
struct __hash_base
|
||||
{
|
||||
typedef _Result result_type;
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type _GLIBCXX17_DEPRECATED;
|
||||
typedef _Arg argument_type _GLIBCXX17_DEPRECATED;
|
||||
};
|
||||
|
||||
/// Primary class template hash.
|
||||
|
|
|
@ -1028,10 +1028,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
: private __poison_hash<remove_const_t<_Tp>>,
|
||||
public __optional_hash_call_base<_Tp>
|
||||
{
|
||||
using result_type = size_t;
|
||||
using argument_type = optional<_Tp>;
|
||||
using result_type [[__deprecated__]] = size_t;
|
||||
using argument_type [[__deprecated__]] = optional<_Tp>;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct __is_fast_hash<hash<optional<_Tp>>> : __is_fast_hash<hash<_Tp>>
|
||||
{ };
|
||||
|
||||
/// @}
|
||||
|
||||
template <typename _Tp> optional(_Tp) -> optional<_Tp>;
|
||||
|
|
|
@ -1420,15 +1420,15 @@ namespace __variant
|
|||
variant<_Types...>, std::index_sequence_for<_Types...>>,
|
||||
public __variant_hash_call_base<_Types...>
|
||||
{
|
||||
using result_type = size_t;
|
||||
using argument_type = variant<_Types...>;
|
||||
using result_type [[__deprecated__]] = size_t;
|
||||
using argument_type [[__deprecated__]] = variant<_Types...>;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct hash<monostate>
|
||||
{
|
||||
using result_type = size_t;
|
||||
using argument_type = monostate;
|
||||
using result_type [[__deprecated__]] = size_t;
|
||||
using argument_type [[__deprecated__]] = monostate;
|
||||
|
||||
size_t
|
||||
operator()(const monostate& __t) const noexcept
|
||||
|
@ -1438,6 +1438,11 @@ namespace __variant
|
|||
}
|
||||
};
|
||||
|
||||
template<typename... _Types>
|
||||
struct __is_fast_hash<hash<variant<_Types...>>>
|
||||
: bool_constant<(__is_fast_hash<_Types>::value && ...)>
|
||||
{ };
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace std
|
||||
|
||||
|
|
Loading…
Reference in New Issue