diff options
author | armenqa <armenqa@yandex-team.com> | 2024-01-19 12:23:50 +0300 |
---|---|---|
committer | armenqa <armenqa@yandex-team.com> | 2024-01-19 13:10:03 +0300 |
commit | 2de0149d0151c514b22bca0760b95b26c9b0b578 (patch) | |
tree | 2bfed9f3bce7e643ddf048bb61ce3dc0a714bcc2 /contrib/libs/cxxsupp/libcxx/include/unordered_map | |
parent | a8c06d218f12b2406fbce24d194885c5d7b68503 (diff) | |
download | ydb-2de0149d0151c514b22bca0760b95b26c9b0b578.tar.gz |
feat contrib: aiogram 3
Relates: https://st.yandex-team.ru/, https://st.yandex-team.ru/
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/unordered_map')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/unordered_map | 67 |
1 files changed, 46 insertions, 21 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/unordered_map b/contrib/libs/cxxsupp/libcxx/include/unordered_map index b2a12cb638..cd0aea1205 100644 --- a/contrib/libs/cxxsupp/libcxx/include/unordered_map +++ b/contrib/libs/cxxsupp/libcxx/include/unordered_map @@ -525,18 +525,15 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__iterator/erase_if_container.h> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> +#include <__memory/allocator.h> +#include <__memory_resource/polymorphic_allocator.h> #include <__node_handle> +#include <__type_traits/is_allocator.h> #include <__utility/forward.h> #include <stdexcept> #include <tuple> #include <version> -#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES -# include <algorithm> -# include <bit> -# include <iterator> -#endif - // standard-mandated includes // [iterator.range] @@ -822,16 +819,16 @@ struct _LIBCPP_STANDALONE_DEBUG __hash_value_type typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type; private: - value_type __cc; + value_type __cc_; public: _LIBCPP_INLINE_VISIBILITY value_type& __get_value() { #if _LIBCPP_STD_VER > 14 - return *_VSTD::launder(_VSTD::addressof(__cc)); + return *_VSTD::launder(_VSTD::addressof(__cc_)); #else - return __cc; + return __cc_; #endif } @@ -839,9 +836,9 @@ public: const value_type& __get_value() const { #if _LIBCPP_STD_VER > 14 - return *_VSTD::launder(_VSTD::addressof(__cc)); + return *_VSTD::launder(_VSTD::addressof(__cc_)); #else - return __cc; + return __cc_; #endif } @@ -904,13 +901,13 @@ struct __hash_value_type typedef pair<const key_type, mapped_type> value_type; private: - value_type __cc; + value_type __cc_; public: _LIBCPP_INLINE_VISIBILITY - value_type& __get_value() { return __cc; } + value_type& __get_value() { return __cc_; } _LIBCPP_INLINE_VISIBILITY - const value_type& __get_value() const { return __cc; } + const value_type& __get_value() const { return __cc_; } private: ~__hash_value_type(); @@ -1044,8 +1041,7 @@ private: typedef __hash_value_type<key_type, mapped_type> __value_type; typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; - typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, - __value_type>::type __allocator_type; + typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; @@ -1062,6 +1058,10 @@ private: typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits<allocator_type> __alloc_traits; + static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, + "[allocator.requirements] states that rebinding an allocator to the same type should result in the " + "original allocator"); + static_assert((is_same<typename __table::__container_value_type, value_type>::value), ""); static_assert((is_same<typename __table::__node_value_type, __value_type>::value), ""); public: @@ -1886,7 +1886,7 @@ inline _LIBCPP_INLINE_VISIBILITY #endif template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -bool +_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { @@ -1934,8 +1934,7 @@ private: typedef __hash_value_type<key_type, mapped_type> __value_type; typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher; typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal; - typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, - __value_type>::type __allocator_type; + typedef __rebind_alloc<allocator_traits<allocator_type>, __value_type> __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; @@ -1952,7 +1951,12 @@ private: static_assert((is_same<typename __node_traits::size_type, typename __alloc_traits::size_type>::value), "Allocator uses different size_type for different types"); -public: + + static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value, + "[allocator.requirements] states that rebinding an allocator to the same type should result in the " + "original allocator"); + + public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __table::size_type size_type; @@ -2592,7 +2596,7 @@ inline _LIBCPP_INLINE_VISIBILITY #endif template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> -bool +_LIBCPP_HIDE_FROM_ABI bool operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { @@ -2625,4 +2629,25 @@ operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, _LIBCPP_END_NAMESPACE_STD +#if _LIBCPP_STD_VER > 14 +_LIBCPP_BEGIN_NAMESPACE_STD +namespace pmr { +template <class _KeyT, class _ValueT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> +using unordered_map = + std::unordered_map<_KeyT, _ValueT, _HashT, _PredT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>; + +template <class _KeyT, class _ValueT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> +using unordered_multimap = + std::unordered_multimap<_KeyT, _ValueT, _HashT, _PredT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>; +} // namespace pmr +_LIBCPP_END_NAMESPACE_STD +#endif + +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <algorithm> +# include <bit> +# include <concepts> +# include <iterator> +#endif + #endif // _LIBCPP_UNORDERED_MAP |