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 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>
135 {
return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
139 {
return _M_real_alloc == __rarg._M_real_alloc; }
141 template<
typename _Up>
144 {
return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
148 {
return _M_real_alloc != __rarg._M_real_alloc; }
150 template<
typename _Up>
156 _M_getUnderlyingImp()
const 157 {
return _M_real_alloc; }
168 typedef std::size_t size_type;
169 typedef std::ptrdiff_t difference_type;
170 typedef void value_type;
177 template<
typename _Up>
185 template<
typename _Tp>
190 __rarg._M_real_alloc = __larg._M_real_alloc;
191 __larg._M_real_alloc = __tmp;
194 _GLIBCXX_END_NAMESPACE_VERSION
An example allocator which uses a non-standard pointer type.This allocator specifies that containers ...
The standard allocator, as per [20.4].
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
allocator<void> specialization.
GNU extensions for public use.