36#ifndef _EXTPTR_ALLOCATOR_H
37#define _EXTPTR_ALLOCATOR_H 1
45namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
47_GLIBCXX_BEGIN_NAMESPACE_VERSION
57 template<
typename _Tp>
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>
81 : _M_real_alloc(__rarg._M_real_alloc) { }
83 template<
typename _Up>
86 : _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
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)
110 { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
112 template<
typename... _Args>
114 construct(
pointer __p, _Args&&... __args)
115 { construct(__p.get(), std::forward<_Args>(__args)...); }
117 template<
typename _Up>
123 { destroy(__p.get()); }
127 void construct(
pointer __p,
const _Tp& __val)
128 { ::new(__p.get()) _Tp(__val); }
134 template<
typename _Up>
137 {
return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
141 {
return _M_real_alloc == __rarg._M_real_alloc; }
143#if __cpp_impl_three_way_comparison < 201907L
144 template<
typename _Up>
147 {
return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
151 {
return _M_real_alloc != __rarg._M_real_alloc; }
154 template<
typename _Up>
160 _M_getUnderlyingImp()
const
161 {
return _M_real_alloc; }
172 typedef std::size_t size_type;
173 typedef std::ptrdiff_t difference_type;
174 typedef void value_type;
183 template<
typename _Up>
184 _ExtPtr_allocator(
const _ExtPtr_allocator<_Up>&) { }
186 template<
typename _Up>
188 {
typedef _ExtPtr_allocator<_Up> other; };
194 template<
typename _Tp>
196 swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg)
199 __rarg._M_real_alloc = __larg._M_real_alloc;
200 __larg._M_real_alloc = __tmp;
203_GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
GNU extensions for public use.
The standard allocator, as per C++03 [20.4.1].
An example allocator which uses a non-standard pointer type.