Use __rebind_pointer to avoid #ifdef block

llvm-svn: 256654
This commit is contained in:
Eric Fiselier 2015-12-30 21:52:00 +00:00
parent 96f7f81aa3
commit 934b092186
6 changed files with 46 additions and 202 deletions

View File

@ -46,12 +46,7 @@ template <class _Tp, class _VoidPtr>
struct __hash_node struct __hash_node
: public __hash_node_base : public __hash_node_base
< <
typename pointer_traits<_VoidPtr>::template typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__hash_node<_Tp, _VoidPtr> >
#else
rebind<__hash_node<_Tp, _VoidPtr> >::other
#endif
> >
{ {
typedef _Tp value_type; typedef _Tp value_type;
@ -98,13 +93,7 @@ public:
typedef typename pointer_traits<__node_pointer>::element_type::value_type value_type; typedef typename pointer_traits<__node_pointer>::element_type::value_type value_type;
typedef typename pointer_traits<__node_pointer>::difference_type difference_type; typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
typedef value_type& reference; typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
@ -229,20 +218,8 @@ public:
typedef typename __node::value_type value_type; typedef typename __node::value_type value_type;
typedef typename pointer_traits<__node_pointer>::difference_type difference_type; typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
typedef const value_type& reference; typedef const value_type& reference;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, const value_type>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES typedef typename __rebind_pointer<__node_pointer, __node>::type __non_const_node_pointer;
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__node>
#else
rebind<__node>::other
#endif
__non_const_node_pointer;
typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator; typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT
@ -376,13 +353,7 @@ public:
typedef typename __pointer_traits::element_type::value_type value_type; typedef typename __pointer_traits::element_type::value_type value_type;
typedef typename __pointer_traits::difference_type difference_type; typedef typename __pointer_traits::difference_type difference_type;
typedef value_type& reference; typedef value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT
{ {
@ -514,13 +485,9 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator
typedef pointer_traits<__node_pointer> __pointer_traits; typedef pointer_traits<__node_pointer> __pointer_traits;
typedef typename __pointer_traits::element_type __node; typedef typename __pointer_traits::element_type __node;
typedef typename remove_const<__node>::type __non_const_node; typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES __non_const_node_pointer;
rebind<__non_const_node>
#else
rebind<__non_const_node>::other
#endif
__non_const_node_pointer;
typedef __hash_local_iterator<__non_const_node_pointer> typedef __hash_local_iterator<__non_const_node_pointer>
__non_const_iterator; __non_const_iterator;
public: public:
@ -530,13 +497,9 @@ public:
>::type value_type; >::type value_type;
typedef typename __pointer_traits::difference_type difference_type; typedef typename __pointer_traits::difference_type difference_type;
typedef const value_type& reference; typedef const value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<__node_pointer, const value_type>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES pointer;
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT
{ {
@ -780,13 +743,8 @@ public:
typedef typename __node_traits::pointer __node_pointer; typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::pointer __node_const_pointer; typedef typename __node_traits::pointer __node_const_pointer;
typedef __hash_node_base<__node_pointer> __first_node; typedef __hash_node_base<__node_pointer> __first_node;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, __first_node>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES __node_base_pointer;
rebind<__first_node>
#else
rebind<__first_node>::other
#endif
__node_base_pointer;
private: private:

View File

@ -548,31 +548,15 @@ template <class _VoidPtr>
class __tree_node_base class __tree_node_base
: public __tree_end_node : public __tree_end_node
< <
typename pointer_traits<_VoidPtr>::template typename __rebind_pointer<_VoidPtr, __tree_node_base<_VoidPtr> >::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__tree_node_base<_VoidPtr> >
#else
rebind<__tree_node_base<_VoidPtr> >::other
#endif
> >
{ {
__tree_node_base(const __tree_node_base&); __tree_node_base(const __tree_node_base&);
__tree_node_base& operator=(const __tree_node_base&); __tree_node_base& operator=(const __tree_node_base&);
public: public:
typedef typename pointer_traits<_VoidPtr>::template typedef typename __rebind_pointer<_VoidPtr, __tree_node_base>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES typedef typename __rebind_pointer<_VoidPtr, const __tree_node_base>::type const_pointer;
rebind<__tree_node_base>
#else
rebind<__tree_node_base>::other
#endif
pointer;
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const __tree_node_base>
#else
rebind<const __tree_node_base>::other
#endif
const_pointer;
typedef __tree_end_node<pointer> base; typedef __tree_end_node<pointer> base;
pointer __right_; pointer __right_;
@ -623,13 +607,7 @@ public:
typedef _Tp value_type; typedef _Tp value_type;
typedef _DiffType difference_type; typedef _DiffType difference_type;
typedef value_type& reference; typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
@ -694,13 +672,7 @@ public:
typedef _Tp value_type; typedef _Tp value_type;
typedef _DiffType difference_type; typedef _DiffType difference_type;
typedef const value_type& reference; typedef const value_type& reference;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, const value_type>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
@ -710,13 +682,8 @@ public:
private: private:
typedef typename remove_const<__node>::type __non_const_node; typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES __non_const_node_pointer;
rebind<__non_const_node>
#else
rebind<__non_const_node>::other
#endif
__non_const_node_pointer;
typedef __tree_iterator<value_type, __non_const_node_pointer, difference_type> typedef __tree_iterator<value_type, __non_const_node_pointer, difference_type>
__non_const_iterator; __non_const_iterator;
public: public:
@ -730,14 +697,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator++() { __tree_const_iterator& operator++() {
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, typename __node::base>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES __node_base_pointer;
rebind<typename __node::base>
#else
rebind<typename __node::base>::other
#endif
__node_base_pointer;
__ptr_ = static_cast<__node_pointer>( __ptr_ = static_cast<__node_pointer>(
__tree_next(static_cast<__node_base_pointer>(__ptr_))); __tree_next(static_cast<__node_base_pointer>(__ptr_)));
return *this; return *this;
@ -749,14 +710,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator--() { __tree_const_iterator& operator--() {
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, typename __node::base>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES __node_base_pointer;
rebind<typename __node::base>
#else
rebind<typename __node::base>::other
#endif
__node_base_pointer;
__ptr_ = static_cast<__node_pointer>( __ptr_ = static_cast<__node_pointer>(
__tree_prev(static_cast<__node_base_pointer>(__ptr_))); __tree_prev(static_cast<__node_base_pointer>(__ptr_)));
return *this; return *this;
@ -810,20 +765,9 @@ public:
typedef typename __node_base::pointer __node_base_const_pointer; typedef typename __node_base::pointer __node_base_const_pointer;
private: private:
typedef typename __node_base::base __end_node_t; typedef typename __node_base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, __end_node_t>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES __end_node_ptr;
rebind<__end_node_t> typedef __end_node_ptr __end_node_const_ptr;
#else
rebind<__end_node_t>::other
#endif
__end_node_ptr;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
#else
rebind<__end_node_t>::other
#endif
__end_node_const_ptr;
__node_pointer __begin_node_; __node_pointer __begin_node_;
__compressed_pair<__end_node_t, __node_allocator> __pair1_; __compressed_pair<__end_node_t, __node_allocator> __pair1_;

View File

@ -368,7 +368,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
{ {
_HashIterator __i_; _HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::first_type key_type; typedef const typename _HashIterator::value_type::first_type key_type;
typedef typename _HashIterator::value_type::second_type mapped_type; typedef typename _HashIterator::value_type::second_type mapped_type;
public: public:
@ -376,13 +375,8 @@ public:
typedef pair<key_type, mapped_type> value_type; typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type; typedef typename _HashIterator::difference_type difference_type;
typedef value_type& reference; typedef value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<typename _HashIterator::pointer, value_type>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES pointer;
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {} _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
@ -419,7 +413,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
{ {
_HashIterator __i_; _HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::first_type key_type; typedef const typename _HashIterator::value_type::first_type key_type;
typedef typename _HashIterator::value_type::second_type mapped_type; typedef typename _HashIterator::value_type::second_type mapped_type;
public: public:
@ -427,13 +420,8 @@ public:
typedef pair<key_type, mapped_type> value_type; typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type; typedef typename _HashIterator::difference_type difference_type;
typedef const value_type& reference; typedef const value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<typename _HashIterator::pointer, const value_type>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES pointer;
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {} _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}

View File

@ -197,15 +197,9 @@ struct __forward_begin_node
template <class _Tp, class _VoidPtr> template <class _Tp, class _VoidPtr>
struct _LIBCPP_HIDDEN __begin_node_of struct _LIBCPP_HIDDEN __begin_node_of
{ {
typedef __forward_begin_node typedef __forward_begin_node<
< typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type
typename pointer_traits<_VoidPtr>::template > type;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__forward_list_node<_Tp, _VoidPtr> >
#else
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
#endif
> type;
}; };
template <class _Tp, class _VoidPtr> template <class _Tp, class _VoidPtr>
@ -240,13 +234,7 @@ public:
typedef value_type& reference; typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::difference_type typedef typename pointer_traits<__node_pointer>::difference_type
difference_type; difference_type;
typedef typename pointer_traits<__node_pointer>::template typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {} __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
@ -295,13 +283,7 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
< <
typename pointer_traits<__node_const_pointer>::element_type typename pointer_traits<__node_const_pointer>::element_type
>::type __node; >::type __node;
typedef typename pointer_traits<__node_const_pointer>::template typedef typename __rebind_pointer<__node_const_pointer, __node>::type __node_pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__node>
#else
rebind<__node>::other
#endif
__node_pointer;
template<class, class> friend class forward_list; template<class, class> friend class forward_list;
@ -311,13 +293,7 @@ public:
typedef const value_type& reference; typedef const value_type& reference;
typedef typename pointer_traits<__node_const_pointer>::difference_type typedef typename pointer_traits<__node_const_pointer>::difference_type
difference_type; difference_type;
typedef typename pointer_traits<__node_const_pointer>::template typedef typename __rebind_pointer<__node_const_pointer, const value_type>::type pointer;
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {} __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}

View File

@ -704,13 +704,8 @@ public:
typedef pair<__key_type, __mapped_type> value_type; typedef pair<__key_type, __mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type; typedef typename _TreeIterator::difference_type difference_type;
typedef value_type& reference; typedef value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<typename __pointer_traits::pointer, value_type>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES pointer;
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__map_iterator() _NOEXCEPT {} __map_iterator() _NOEXCEPT {}
@ -770,13 +765,8 @@ public:
typedef pair<__key_type, __mapped_type> value_type; typedef pair<__key_type, __mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type; typedef typename _TreeIterator::difference_type difference_type;
typedef const value_type& reference; typedef const value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<typename __pointer_traits::pointer, const value_type>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES pointer;
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__map_const_iterator() _NOEXCEPT {} __map_const_iterator() _NOEXCEPT {}

View File

@ -656,7 +656,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
{ {
_HashIterator __i_; _HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::value_type::first_type key_type; typedef const typename _HashIterator::value_type::value_type::first_type key_type;
typedef typename _HashIterator::value_type::value_type::second_type mapped_type; typedef typename _HashIterator::value_type::value_type::second_type mapped_type;
public: public:
@ -664,13 +663,8 @@ public:
typedef pair<key_type, mapped_type> value_type; typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type; typedef typename _HashIterator::difference_type difference_type;
typedef value_type& reference; typedef value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<typename _HashIterator::pointer, value_type>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES pointer;
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__hash_map_iterator() _NOEXCEPT {} __hash_map_iterator() _NOEXCEPT {}
@ -712,7 +706,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
{ {
_HashIterator __i_; _HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::value_type::first_type key_type; typedef const typename _HashIterator::value_type::value_type::first_type key_type;
typedef typename _HashIterator::value_type::value_type::second_type mapped_type; typedef typename _HashIterator::value_type::value_type::second_type mapped_type;
public: public:
@ -720,13 +713,8 @@ public:
typedef pair<key_type, mapped_type> value_type; typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type; typedef typename _HashIterator::difference_type difference_type;
typedef const value_type& reference; typedef const value_type& reference;
typedef typename __pointer_traits::template typedef typename __rebind_pointer<typename _HashIterator::pointer, const value_type>::type
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES pointer;
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator() _NOEXCEPT {} __hash_map_const_iterator() _NOEXCEPT {}