diff options
-rw-r--r-- | libcxx/include/__functional_03 | 32 | ||||
-rw-r--r-- | libcxx/include/__hash_table | 16 | ||||
-rw-r--r-- | libcxx/include/__tree | 8 | ||||
-rw-r--r-- | libcxx/include/deque | 16 | ||||
-rw-r--r-- | libcxx/include/ext/hash_map | 16 | ||||
-rw-r--r-- | libcxx/include/forward_list | 16 | ||||
-rw-r--r-- | libcxx/include/functional | 24 | ||||
-rw-r--r-- | libcxx/include/list | 16 | ||||
-rw-r--r-- | libcxx/include/map | 18 | ||||
-rw-r--r-- | libcxx/include/memory | 10 | ||||
-rw-r--r-- | libcxx/include/unordered_map | 18 | ||||
-rw-r--r-- | libcxx/include/vector | 8 |
12 files changed, 37 insertions, 161 deletions
diff --git a/libcxx/include/__functional_03 b/libcxx/include/__functional_03 index 157d6bf8932..785a2758c05 100644 --- a/libcxx/include/__functional_03 +++ b/libcxx/include/__functional_03 @@ -798,13 +798,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, } else { - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<_FF> -#else - rebind_alloc<_FF>::other -#endif - _Ap; + typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); @@ -1100,13 +1094,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, } else { - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<_FF> -#else - rebind_alloc<_FF>::other -#endif - _Ap; + typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); @@ -1402,13 +1390,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f, } else { - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<_FF> -#else - rebind_alloc<_FF>::other -#endif - _Ap; + typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); @@ -1704,13 +1686,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp } else { - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<_FF> -#else - rebind_alloc<_FF>::other -#endif - _Ap; + typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table index 71b12b36e54..e41ccf293eb 100644 --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -775,13 +775,7 @@ public: public: // Create __node typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__node> -#else - rebind_alloc<__node>::other -#endif - __node_allocator; + typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_traits; typedef typename __node_traits::pointer __node_pointer; typedef typename __node_traits::pointer __node_const_pointer; @@ -796,13 +790,7 @@ public: private: - typedef typename __node_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__node_pointer> -#else - rebind_alloc<__node_pointer>::other -#endif - __pointer_allocator; + typedef typename __rebind_alloc_helper<__node_traits, __node_pointer>::type __pointer_allocator; typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter; typedef unique_ptr<__node_pointer[], __bucket_list_deleter> __bucket_list; typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits; diff --git a/libcxx/include/__tree b/libcxx/include/__tree index 77bf0812654..588f4380766 100644 --- a/libcxx/include/__tree +++ b/libcxx/include/__tree @@ -802,13 +802,7 @@ public: typedef __tree_node<value_type, __void_pointer> __node; typedef __tree_node_base<__void_pointer> __node_base; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__node> -#else - rebind_alloc<__node>::other -#endif - __node_allocator; + typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_traits; typedef typename __node_traits::pointer __node_pointer; typedef typename __node_traits::pointer __node_const_pointer; diff --git a/libcxx/include/deque b/libcxx/include/deque index 8d0d2a8f499..78ef118c305 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -912,22 +912,10 @@ protected: static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<pointer> -#else - rebind_alloc<pointer>::other -#endif - __pointer_allocator; + typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator; typedef allocator_traits<__pointer_allocator> __map_traits; typedef typename __map_traits::pointer __map_pointer; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<const_pointer> -#else - rebind_alloc<const_pointer>::other -#endif - __const_pointer_allocator; + typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator; typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer; typedef __split_buffer<pointer, __pointer_allocator> __map; diff --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map index 36cd595e034..d8fc1e6c03c 100644 --- a/libcxx/include/ext/hash_map +++ b/libcxx/include/ext/hash_map @@ -493,13 +493,7 @@ private: typedef pair<key_type, mapped_type> __value_type; typedef __hash_map_hasher<__value_type, hasher> __hasher; typedef __hash_map_equal<__value_type, key_equal> __key_equal; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__value_type> -#else - rebind_alloc<__value_type>::other -#endif - __allocator_type; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; @@ -772,13 +766,7 @@ private: typedef pair<key_type, mapped_type> __value_type; typedef __hash_map_hasher<__value_type, hasher> __hasher; typedef __hash_map_equal<__value_type, key_equal> __key_equal; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__value_type> -#else - rebind_alloc<__value_type>::other -#endif - __allocator_type; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list index a442a9b6386..fbb850c3b23 100644 --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -365,24 +365,12 @@ protected: typedef typename allocator_traits<allocator_type>::void_pointer void_pointer; typedef __forward_list_node<value_type, void_pointer> __node; typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__node> -#else - rebind_alloc<__node>::other -#endif - __node_allocator; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_traits; typedef typename __node_traits::pointer __node_pointer; typedef typename __node_traits::pointer __node_const_pointer; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__begin_node> -#else - rebind_alloc<__begin_node>::other -#endif - __begin_node_allocator; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __begin_node>::type __begin_node_allocator; typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer; __compressed_pair<__begin_node, __node_allocator> __before_begin_; diff --git a/libcxx/include/functional b/libcxx/include/functional index 35e661b626a..a5a212cc81a 100644 --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -1368,13 +1368,7 @@ __base<_Rp(_ArgTypes...)>* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const { typedef allocator_traits<_Alloc> __alloc_traits; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__func> -#else - rebind_alloc<__func>::other -#endif - _Ap; + typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; _Ap __a(__f_.second()); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); @@ -1401,13 +1395,7 @@ void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT { typedef allocator_traits<_Alloc> __alloc_traits; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__func> -#else - rebind_alloc<__func>::other -#endif - _Ap; + typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; _Ap __a(__f_.second()); __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); @@ -1668,13 +1656,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _ if (__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<_FF> -#else - rebind_alloc<_FF>::other -#endif - _Ap; + typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap; _Ap __a(__a0); if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value && is_nothrow_copy_constructible<_Ap>::value) diff --git a/libcxx/include/list b/libcxx/include/list index c1a7a1821c4..d39f076711d 100644 --- a/libcxx/include/list +++ b/libcxx/include/list @@ -515,13 +515,7 @@ protected: typedef __list_const_iterator<value_type, __void_pointer> const_iterator; typedef __list_node_base<value_type, __void_pointer> __node_base; typedef __list_node<value_type, __void_pointer> __node; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__node> -#else - rebind_alloc<__node>::other -#endif - __node_allocator; + typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_alloc_traits; typedef typename __node_alloc_traits::pointer __node_pointer; typedef typename __node_alloc_traits::pointer __node_const_pointer; @@ -529,13 +523,7 @@ protected: typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __alloc_traits::difference_type difference_type; - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__node_base> -#else - rebind_alloc<__node_base>::other -#endif - __node_base_allocator; + typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator; typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer; __node_base __end_; diff --git a/libcxx/include/map b/libcxx/include/map index 0b5eb209490..c8e8fd1f1df 100644 --- a/libcxx/include/map +++ b/libcxx/include/map @@ -822,13 +822,8 @@ private: typedef _VSTD::__value_type<key_type, mapped_type> __value_type; typedef __map_value_compare<key_type, __value_type, key_compare> __vc; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__value_type> -#else - rebind_alloc<__value_type>::other -#endif - __allocator_type; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, + __value_type>::type __allocator_type; typedef __tree<__value_type, __vc, __allocator_type> __base; typedef typename __base::__node_traits __node_traits; typedef allocator_traits<allocator_type> __alloc_traits; @@ -1568,13 +1563,8 @@ private: typedef _VSTD::__value_type<key_type, mapped_type> __value_type; typedef __map_value_compare<key_type, __value_type, key_compare> __vc; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__value_type> -#else - rebind_alloc<__value_type>::other -#endif - __allocator_type; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, + __value_type>::type __allocator_type; typedef __tree<__value_type, __vc, __allocator_type> __base; typedef typename __base::__node_traits __node_traits; typedef allocator_traits<allocator_type> __alloc_traits; diff --git a/libcxx/include/memory b/libcxx/include/memory index 43f8dbadadc..93e8f67379b 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -1635,6 +1635,16 @@ private: {return __a;} }; +template <class _Traits, class _Tp> +struct __rebind_alloc_helper +{ +#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES + typedef typename _Traits::template rebind_alloc<_Tp> type; +#else + typedef typename _Traits::template rebind_alloc<_Tp>::other type; +#endif +}; + // allocator template <class _Tp> diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index 0fa87d19ad0..3190ddf7fb2 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -730,13 +730,8 @@ private: typedef __hash_value_type<key_type, mapped_type> __value_type; typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__value_type> -#else - rebind_alloc<__value_type>::other -#endif - __allocator_type; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, + __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; @@ -1469,13 +1464,8 @@ private: typedef __hash_value_type<key_type, mapped_type> __value_type; typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; - typedef typename allocator_traits<allocator_type>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__value_type> -#else - rebind_alloc<__value_type>::other -#endif - __allocator_type; + typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, + __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; diff --git a/libcxx/include/vector b/libcxx/include/vector index efe21e111d0..48e970a2f40 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -2125,13 +2125,7 @@ public: typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; private: - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<__storage_type> -#else - rebind_alloc<__storage_type>::other -#endif - __storage_allocator; + typedef typename __rebind_alloc_helper<__alloc_traits, __storage_type>::type __storage_allocator; typedef allocator_traits<__storage_allocator> __storage_traits; typedef typename __storage_traits::pointer __storage_pointer; typedef typename __storage_traits::const_pointer __const_storage_pointer; |