36 #ifndef _EXTPTR_ALLOCATOR_H
37 #define _EXTPTR_ALLOCATOR_H 1
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 template<
typename _Tp>
56 class _ExtPtr_allocator
63 typedef _Pointer_adapter<_Relative_pointer_impl<_Tp> > pointer;
64 typedef _Pointer_adapter<_Relative_pointer_impl<const _Tp> >
67 typedef _Tp& reference;
68 typedef const _Tp& const_reference;
69 typedef _Tp value_type;
71 template<
typename _Up>
73 {
typedef _ExtPtr_allocator<_Up> other; };
75 _ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
78 _ExtPtr_allocator(
const _ExtPtr_allocator& __rarg) _GLIBCXX_USE_NOEXCEPT
79 : _M_real_alloc(__rarg._M_real_alloc) { }
81 template<
typename _Up>
82 _ExtPtr_allocator(
const _ExtPtr_allocator<_Up>& __rarg)
84 : _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
86 ~_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
89 pointer address(reference __x)
const _GLIBCXX_NOEXCEPT
90 {
return std::__addressof(__x); }
92 const_pointer address(const_reference __x)
const _GLIBCXX_NOEXCEPT
93 {
return std::__addressof(__x); }
95 pointer allocate(size_type __n,
void* __hint = 0)
96 {
return _M_real_alloc.allocate(__n,__hint); }
98 void deallocate(pointer __p, size_type __n)
99 { _M_real_alloc.deallocate(__p.get(), __n); }
101 size_type max_size() const _GLIBCXX_USE_NOEXCEPT
102 {
return __numeric_traits<size_type>::__max /
sizeof(_Tp); }
104 #if __cplusplus >= 201103L
105 template<
typename _Up,
typename... _Args>
107 construct(_Up* __p, _Args&&... __args)
108 { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
110 template<typename... _Args>
112 construct(pointer __p, _Args&&... __args)
113 { construct(__p.get(), std::forward<_Args>(__args)...); }
115 template<
typename _Up>
120 void destroy(pointer __p)
121 { destroy(__p.get()); }
125 void construct(pointer __p,
const _Tp& __val)
126 { ::new(__p.get()) _Tp(__val); }
128 void destroy(pointer __p)
132 template<
typename _Up>
134 operator==(
const _ExtPtr_allocator<_Up>& __rarg)
135 {
return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
139 {
return _M_real_alloc == __rarg._M_real_alloc; }
141 template<
typename _Up>
143 operator!=(
const _ExtPtr_allocator<_Up>& __rarg)
144 {
return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
148 {
return _M_real_alloc != __rarg._M_real_alloc; }
150 template<
typename _Up>
152 swap(_ExtPtr_allocator<_Up>&, _ExtPtr_allocator<_Up>&);
155 const std::allocator<_Tp>&
156 _M_getUnderlyingImp()
const
157 {
return _M_real_alloc; }
160 std::allocator<_Tp> _M_real_alloc;
165 class _ExtPtr_allocator<void>
170 typedef void value_type;
173 typedef _Pointer_adapter<_Relative_pointer_impl<void> > pointer;
174 typedef _Pointer_adapter<_Relative_pointer_impl<const void> >
177 template<
typename _Up>
179 {
typedef _ExtPtr_allocator<_Up> other; };
182 std::allocator<void> _M_real_alloc;
185 template<
typename _Tp>
187 swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg)
189 std::allocator<_Tp> __tmp( __rarg._M_real_alloc );
190 __rarg._M_real_alloc = __larg._M_real_alloc;
191 __larg._M_real_alloc = __tmp;
194 _GLIBCXX_END_NAMESPACE_VERSION
bool operator==(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
namespace std _GLIBCXX_VISIBILITY(default)
Definition: auto_ptr.h:36
bool operator!=(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
__SIZE_TYPE__ size_t
Definition: stddef.h:212
__PTRDIFF_TYPE__ ptrdiff_t
Definition: stddef.h:147
void swap(exception_ptr &__lhs, exception_ptr &__rhs)
Definition: exception_ptr.h:160