36 #ifndef _EXTPTR_ALLOCATOR_H
37 #define _EXTPTR_ALLOCATOR_H 1
43 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 template<
typename _Tp>
59 typedef std::size_t size_type;
60 typedef std::ptrdiff_t difference_type;
67 typedef _Tp& reference;
68 typedef const _Tp& const_reference;
69 typedef _Tp value_type;
71 template<
typename _Up>
79 : _M_real_alloc(__rarg._M_real_alloc) { }
81 template<
typename _Up>
84 : _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
89 pointer address(reference __x)
const _GLIBCXX_NOEXCEPT
92 const_pointer address(const_reference __x)
const _GLIBCXX_NOEXCEPT
95 _GLIBCXX_NODISCARD
pointer allocate(size_type __n,
const void* = 0)
96 {
return _M_real_alloc.allocate(__n); }
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>
121 { destroy(__p.get()); }
125 void construct(
pointer __p,
const _Tp& __val)
126 { ::new(__p.get()) _Tp(__val); }
132 template<
typename _Up>
135 {
return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
139 {
return _M_real_alloc == __rarg._M_real_alloc; }
141 #if __cpp_impl_three_way_comparison < 201907L
142 template<
typename _Up>
145 {
return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
149 {
return _M_real_alloc != __rarg._M_real_alloc; }
152 template<
typename _Up>
158 _M_getUnderlyingImp()
const
159 {
return _M_real_alloc; }
170 typedef std::size_t size_type;
171 typedef std::ptrdiff_t difference_type;
172 typedef void value_type;
181 template<
typename _Up>
182 _ExtPtr_allocator(
const _ExtPtr_allocator<_Up>&) { }
184 template<
typename _Up>
186 {
typedef _ExtPtr_allocator<_Up> other; };
192 template<
typename _Tp>
194 swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg)
197 __rarg._M_real_alloc = __larg._M_real_alloc;
198 __larg._M_real_alloc = __tmp;
201 _GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
GNU extensions for public use.
allocator<void> specialization.
The standard allocator, as per C++03 [20.4.1].
An example allocator which uses a non-standard pointer type.