58 class _ExtPtr_allocator
61 typedef std::size_t size_type;
62 typedef std::ptrdiff_t difference_type;
69 typedef _Tp& reference;
70 typedef const _Tp& const_reference;
71 typedef _Tp value_type;
73 template<
typename _Up>
75 {
typedef _ExtPtr_allocator<_Up>
other; };
77 _ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
80 _ExtPtr_allocator(
const _ExtPtr_allocator& __rarg) _GLIBCXX_USE_NOEXCEPT
81 : _M_real_alloc(__rarg._M_real_alloc) { }
83 template<
typename _Up>
84 _ExtPtr_allocator(
const _ExtPtr_allocator<_Up>& __rarg)
86 : _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
88 ~_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
91 pointer address(reference __x)
const _GLIBCXX_NOEXCEPT
94 const_pointer address(const_reference __x)
const _GLIBCXX_NOEXCEPT
97 _GLIBCXX_NODISCARD pointer allocate(size_type __n,
const void* = 0)
98 {
return _M_real_alloc.
allocate(__n); }
100 void deallocate(pointer __p, size_type __n)
101 { _M_real_alloc.deallocate(__p.get(), __n); }
103 size_type max_size()
const _GLIBCXX_USE_NOEXCEPT
104 {
return __numeric_traits<size_type>::__max /
sizeof(_Tp); }
106#if __cplusplus >= 201103L
107 template<
typename _Up,
typename... _Args>
109 construct(_Up* __p, _Args&&... __args)
112 template<
typename... _Args>
114 construct(pointer __p, _Args&&... __args)
117 template<
typename _Up>
122 void destroy(pointer __p)
123 { destroy(__p.get()); }
127 void construct(pointer __p,
const _Tp& __val)
128 { ::new(__p.get()) _Tp(__val); }
130 void destroy(pointer __p)
134 template<
typename _Up>
136 operator==(
const _ExtPtr_allocator<_Up>& __rarg)
const
137 {
return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
140 operator==(
const _ExtPtr_allocator& __rarg)
const
141 {
return _M_real_alloc == __rarg._M_real_alloc; }
143#if __cpp_impl_three_way_comparison < 201907L
144 template<
typename _Up>
146 operator!=(
const _ExtPtr_allocator<_Up>& __rarg)
const
147 {
return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
150 operator!=(
const _ExtPtr_allocator& __rarg)
const
151 {
return _M_real_alloc != __rarg._M_real_alloc; }
154 template<
typename _Up>
156 swap(_ExtPtr_allocator<_Up>&, _ExtPtr_allocator<_Up>&);
160 _M_getUnderlyingImp()
const
161 {
return _M_real_alloc; }