66 typedef _Tp value_type;
67 typedef std::size_t size_type;
68 typedef std::ptrdiff_t difference_type;
69#if __cplusplus <= 201703L
71 typedef const _Tp* const_pointer;
72 typedef _Tp& reference;
73 typedef const _Tp& const_reference;
75 template<
typename _Tp1>
80#if __cplusplus >= 201103L
86 __attribute__((__always_inline__))
90 __attribute__((__always_inline__))
94 template<
typename _Tp1>
95 __attribute__((__always_inline__))
99#if __cplusplus >= 201103L
103#if __cplusplus <= 201703L
107 address(reference __x)
const _GLIBCXX_NOEXCEPT
111 address(const_reference __x)
const _GLIBCXX_NOEXCEPT
115#if __has_builtin(__builtin_operator_new) >= 201802L
116# define _GLIBCXX_OPERATOR_NEW __builtin_operator_new
117# define _GLIBCXX_OPERATOR_DELETE __builtin_operator_delete
119# define _GLIBCXX_OPERATOR_NEW ::operator new
120# define _GLIBCXX_OPERATOR_DELETE ::operator delete
125 _GLIBCXX_NODISCARD _Tp*
126 allocate(size_type __n,
const void* =
static_cast<const void*
>(0))
128#if __cplusplus >= 201103L
131 static_assert(
sizeof(_Tp) != 0,
"cannot allocate incomplete types");
134 if (__builtin_expect(__n > this->_M_max_size(),
false))
138 if (__n > (std::size_t(-1) /
sizeof(_Tp)))
139 std::__throw_bad_array_new_length();
140 std::__throw_bad_alloc();
144 if (
alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
146 std::align_val_t __al = std::align_val_t(
alignof(_Tp));
147 return static_cast<_Tp*
>(_GLIBCXX_OPERATOR_NEW(__n *
sizeof(_Tp),
151 return static_cast<_Tp*
>(_GLIBCXX_OPERATOR_NEW(__n *
sizeof(_Tp)));
156 deallocate(_Tp* __p, size_type __n __attribute__ ((__unused__)))
158#if __cpp_sized_deallocation
159# define _GLIBCXX_SIZED_DEALLOC(p, n) (p), (n) * sizeof(_Tp)
161# define _GLIBCXX_SIZED_DEALLOC(p, n) (p)
165 if (
alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
167 _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n),
168 std::align_val_t(
alignof(_Tp)));
172 _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
175#undef _GLIBCXX_SIZED_DEALLOC
176#undef _GLIBCXX_OPERATOR_DELETE
177#undef _GLIBCXX_OPERATOR_NEW
179#if __cplusplus <= 201703L
180 __attribute__((__always_inline__))
182 max_size()
const _GLIBCXX_USE_NOEXCEPT
183 {
return _M_max_size(); }
185#if __cplusplus >= 201103L
186 template<
typename _Up,
typename... _Args>
187 __attribute__((__always_inline__))
189 construct(_Up* __p, _Args&&... __args)
191 { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
193 template<
typename _Up>
194 __attribute__((__always_inline__))
202 __attribute__((__always_inline__))
204 construct(pointer __p,
const _Tp& __val)
205 { ::new((
void *)__p) _Tp(__val); }
207 __attribute__((__always_inline__))
209 destroy(pointer __p) { __p->~_Tp(); }
213 template<
typename _Up>
214 friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR
bool
219#if __cpp_impl_three_way_comparison < 201907L
220 template<
typename _Up>
221 friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR
bool
228 __attribute__((__always_inline__))
229 _GLIBCXX_CONSTEXPR size_type
230 _M_max_size()
const _GLIBCXX_USE_NOEXCEPT
232#if __PTRDIFF_MAX__ < __SIZE_MAX__
233 return std::size_t(__PTRDIFF_MAX__) /
sizeof(_Tp);
235 return std::size_t(-1) /
sizeof(_Tp);