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 129 array_type* _M_array;
133 template<
typename _Tp1,
typename _Array1 = _Array>
137 } _GLIBCXX_DEPRECATED;
140 : _M_array(__array), _M_used(size_type()) { }
143 : _M_array(__o._M_array), _M_used(__o._M_used) { }
145 template<
typename _Tp1,
typename _Array1>
147 _GLIBCXX_USE_NOEXCEPT
148 : _M_array(0), _M_used(size_type()) { }
153 allocate(size_type __n,
const void* = 0)
155 if (_M_array == 0 || _M_used + __n > _M_array->size())
156 std::__throw_bad_alloc();
157 pointer __ret = _M_array->begin() + _M_used;
161 } _GLIBCXX_DEPRECATED;
163 template<
typename _Tp,
typename _Array>
169 template<
typename _Tp,
typename _Array>
175 _GLIBCXX_END_NAMESPACE_VERSION
178 #pragma GCC diagnostic pop
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
GNU extensions for public use.
An allocator that uses previously allocated memory. This memory can be externally, globally, or otherwise allocated.