29 #ifndef _ARRAY_ALLOCATOR_H 30 #define _ARRAY_ALLOCATOR_H 1 37 #if __cplusplus >= 201103L 42 #pragma GCC diagnostic push 43 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 45 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 template<
typename _Tp>
57 typedef size_t size_type;
58 typedef ptrdiff_t difference_type;
60 typedef const _Tp* const_pointer;
61 typedef _Tp& reference;
62 typedef const _Tp& const_reference;
63 typedef _Tp value_type;
66 address(reference __x)
const _GLIBCXX_NOEXCEPT
70 address(const_reference __x)
const _GLIBCXX_NOEXCEPT
74 deallocate(pointer, size_type)
80 max_size()
const _GLIBCXX_USE_NOEXCEPT
81 {
return size_t(-1) /
sizeof(_Tp); }
83 #if __cplusplus >= 201103L 84 template<
typename _Up,
typename... _Args>
86 construct(_Up* __p, _Args&&... __args)
87 { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
89 template<
typename _Up>
91 destroy(_Up* __p) { __p->~_Up(); }
96 construct(pointer __p,
const _Tp& __val)
97 { ::new((
void *)__p) value_type(__val); }
100 destroy(pointer __p) { __p->~_Tp(); }
102 } _GLIBCXX_DEPRECATED;
109 template<
typename _Tp,
typename _Array = std::tr1::array<_Tp, 1> >
113 typedef size_t size_type;
114 typedef ptrdiff_t difference_type;
115 typedef _Tp* pointer;
116 typedef const _Tp* const_pointer;
117 typedef _Tp& reference;
118 typedef const _Tp& const_reference;
119 typedef _Tp value_type;
120 typedef _Array array_type;
122 #if __cplusplus >= 201103L 131 array_type* _M_array;
135 template<
typename _Tp1,
typename _Array1 = _Array>
139 } _GLIBCXX_DEPRECATED;
142 : _M_array(__array), _M_used(size_type()) { }
145 : _M_array(__o._M_array), _M_used(__o._M_used) { }
147 template<
typename _Tp1,
typename _Array1>
149 _GLIBCXX_USE_NOEXCEPT
150 : _M_array(0), _M_used(size_type()) { }
154 _GLIBCXX_NODISCARD pointer
155 allocate(size_type __n,
const void* = 0)
157 if (_M_array == 0 || _M_used + __n > _M_array->size())
158 std::__throw_bad_alloc();
159 pointer __ret = _M_array->begin() + _M_used;
163 } _GLIBCXX_DEPRECATED;
165 template<
typename _Tp,
typename _Array>
171 template<
typename _Tp,
typename _Array>
173 operator!=(
const array_allocator<_Tp, _Array>&,
174 const array_allocator<_Tp, _Array>&)
177 _GLIBCXX_END_NAMESPACE_VERSION
180 #pragma GCC diagnostic pop
An allocator that uses previously allocated memory. This memory can be externally, globally, or otherwise allocated.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
GNU extensions for public use.