@@ -49,50 +49,38 @@ using __pointer_member _LIBCPP_NODEBUG = typename _Tp::pointer;
49
49
template <class _Tp , class _Alloc >
50
50
using __pointer _LIBCPP_NODEBUG = __detected_or_t <_Tp*, __pointer_member, __libcpp_remove_reference_t <_Alloc> >;
51
51
52
- // __const_pointer
53
- _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX (__has_const_pointer, const_pointer);
54
- template <class _Tp , class _Ptr , class _Alloc , bool = __has_const_pointer<_Alloc>::value>
55
- struct __const_pointer {
56
- using type _LIBCPP_NODEBUG = typename _Alloc::const_pointer;
57
- };
58
- template <class _Tp , class _Ptr , class _Alloc >
59
- struct __const_pointer <_Tp, _Ptr, _Alloc, false > {
52
+ template <class _Ptr , class _Alloc , class _Tp , template <class > class _Alias , class = void >
53
+ struct __rebind_or_alias_pointer {
60
54
#ifdef _LIBCPP_CXX03_LANG
61
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
55
+ using type = typename pointer_traits<_Ptr>::template rebind<_Tp>::other;
62
56
#else
63
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
57
+ using type = typename pointer_traits<_Ptr>::template rebind<_Tp>;
64
58
#endif
65
59
};
66
60
67
- // __void_pointer
68
- _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX (__has_void_pointer, void_pointer);
69
- template <class _Ptr , class _Alloc , bool = __has_void_pointer<_Alloc>::value>
70
- struct __void_pointer {
71
- using type _LIBCPP_NODEBUG = typename _Alloc::void_pointer;
61
+ template <class _Ptr , class _Alloc , class _Tp , template <class > class _Alias >
62
+ struct __rebind_or_alias_pointer <_Ptr, _Alloc, _Tp, _Alias, __void_t <_Alias<_Alloc> > > {
63
+ using type = _Alias<_Alloc>;
72
64
};
65
+
66
+ template <class _Alloc >
67
+ using __const_pointer_member _LIBCPP_NODEBUG = typename _Alloc::const_pointer;
68
+
69
+ template <class _Tp , class _Ptr , class _Alloc >
70
+ using __const_pointer _LIBCPP_NODEBUG = __rebind_or_alias_pointer<_Ptr, _Alloc, const _Tp, __const_pointer_member>;
71
+
72
+ template <class _Alloc >
73
+ using __void_pointer_member _LIBCPP_NODEBUG = typename _Alloc::void_pointer;
74
+
73
75
template <class _Ptr , class _Alloc >
74
- struct __void_pointer <_Ptr, _Alloc, false > {
75
- #ifdef _LIBCPP_CXX03_LANG
76
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void >::other;
77
- #else
78
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<void >;
79
- #endif
80
- };
76
+ using __void_pointer _LIBCPP_NODEBUG = __rebind_or_alias_pointer<_Ptr, _Alloc, void , __void_pointer_member>;
77
+
78
+ template <class _Alloc >
79
+ using __const_void_pointer_member _LIBCPP_NODEBUG = typename _Alloc::const_void_pointer;
81
80
82
- // __const_void_pointer
83
- _LIBCPP_ALLOCATOR_TRAITS_HAS_XXX (__has_const_void_pointer, const_void_pointer);
84
- template <class _Ptr , class _Alloc , bool = __has_const_void_pointer<_Alloc>::value>
85
- struct __const_void_pointer {
86
- using type _LIBCPP_NODEBUG = typename _Alloc::const_void_pointer;
87
- };
88
81
template <class _Ptr , class _Alloc >
89
- struct __const_void_pointer <_Ptr, _Alloc, false > {
90
- #ifdef _LIBCPP_CXX03_LANG
91
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void >::other;
92
- #else
93
- using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const void >;
94
- #endif
95
- };
82
+ using __const_void_pointer _LIBCPP_NODEBUG =
83
+ __rebind_or_alias_pointer<_Ptr, _Alloc, const void , __const_void_pointer_member>;
96
84
97
85
// __size_type
98
86
template <class _Tp >
0 commit comments