31 #define _PTR_TRAITS_H 1 33 #if __cplusplus >= 201103L 37 namespace std _GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
41 _GLIBCXX_HAS_NESTED_TYPE(element_type)
42 _GLIBCXX_HAS_NESTED_TYPE(difference_type)
44 template<typename _Tp,
bool = __has_element_type<_Tp>::value>
45 struct __ptrtr_elt_type;
47 template<typename _Tp>
48 struct __ptrtr_elt_type<_Tp, true>
50 typedef typename _Tp::element_type __type;
53 template<
template<
typename,
typename...>
class _SomePtr,
typename _Tp,
55 struct __ptrtr_elt_type<_SomePtr<_Tp, _Args...>, false>
60 template<typename _Tp, bool = __has_difference_type<_Tp>::value>
61 struct __ptrtr_diff_type
63 typedef typename _Tp::difference_type __type;
66 template<
typename _Tp>
67 struct __ptrtr_diff_type<_Tp, false>
69 typedef ptrdiff_t __type;
72 template<
typename _Ptr,
typename _Up>
73 class __ptrtr_rebind_helper
75 template<
typename _Ptr2,
typename _Up2>
77 _S_chk(
typename _Ptr2::template rebind<_Up2>*);
79 template<
typename,
typename>
84 using __type = decltype(_S_chk<_Ptr, _Up>(
nullptr));
87 template<
typename _Tp,
typename _Up,
88 bool = __ptrtr_rebind_helper<_Tp, _Up>::__type::value>
89 struct __ptrtr_rebind;
91 template<
typename _Tp,
typename _Up>
92 struct __ptrtr_rebind<_Tp, _Up, true>
94 typedef typename _Tp::template rebind<_Up> __type;
97 template<
template<
typename,
typename...>
class _SomePtr,
typename _Up,
98 typename _Tp,
typename... _Args>
99 struct __ptrtr_rebind<_SomePtr<_Tp, _Args...>, _Up, false>
101 typedef _SomePtr<_Up, _Args...> __type;
104 template<typename _Tp, typename = typename remove_cv<_Tp>::type>
105 struct __ptrtr_not_void
110 template<
typename _Tp>
111 struct __ptrtr_not_void<_Tp, void>
116 template<
typename _Ptr>
117 class __ptrtr_pointer_to
119 typedef typename __ptrtr_elt_type<_Ptr>::__type __orig_type;
120 typedef typename __ptrtr_not_void<__orig_type>::__type __element_type;
123 static _Ptr pointer_to(__element_type& __e)
124 {
return _Ptr::pointer_to(__e); }
131 template<
typename _Ptr>
141 template<
typename _Up>
142 using rebind =
typename __ptrtr_rebind<_Ptr, _Up>::__type;
149 template<
typename _Tp>
159 template<
typename _Up>
168 pointer_to(
typename __ptrtr_not_void<element_type>::__type& __r) noexcept
172 _GLIBCXX_END_NAMESPACE_VERSION
__ptrtr_diff_type< _Ptr >::__type difference_type
Type used to represent the difference between two pointers.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
_Tp element_type
The type pointed to.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
ptrdiff_t difference_type
Type used to represent the difference between two pointers.
_Tp * addressof(_Tp &__r) noexcept
Returns the actual address of the object or function referenced by r, even in the presence of an over...
static pointer pointer_to(typename __ptrtr_not_void< element_type >::__type &__r) noexcept
Obtain a pointer to an object.
__ptrtr_elt_type< _Ptr >::__type element_type
The type pointed to.
Uniform interface to all pointer-like types.
_Tp * pointer
The pointer type.
ISO C++ entities toplevel namespace is std.
_Ptr pointer
The pointer type.