44 #define _ALLOCATOR_H 1
48 #if __cplusplus >= 201103L
52 #pragma GCC diagnostic push
53 #pragma GCC diagnostic ignored "-Wc++11-extensions"
55 namespace std _GLIBCXX_VISIBILITY(default)
57 _GLIBCXX_BEGIN_NAMESPACE_VERSION
79 typedef void value_type;
80 typedef size_t size_type;
81 typedef ptrdiff_t difference_type;
83 #if __cplusplus <= 201703L
85 typedef void* pointer;
86 typedef const void* const_pointer;
88 template<
typename _Tp1>
93 #if __cplusplus >= 201103L
96 using propagate_on_container_move_assignment =
true_type;
98 #if __cplusplus <= 202302L
100 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
104 #if __cplusplus >= 202002L
110 template<
typename _Up>
111 __attribute__((__always_inline__))
132 template<
typename _Tp>
136 typedef _Tp value_type;
137 typedef size_t size_type;
138 typedef ptrdiff_t difference_type;
140 #if __cplusplus <= 201703L
142 typedef _Tp* pointer;
143 typedef const _Tp* const_pointer;
144 typedef _Tp& reference;
145 typedef const _Tp& const_reference;
147 template<
typename _Tp1>
152 #if __cplusplus >= 201103L
155 using propagate_on_container_move_assignment =
true_type;
157 #if __cplusplus <= 202302L
158 using is_always_equal
159 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
166 __attribute__((__always_inline__))
170 __attribute__((__always_inline__))
175 #if __cplusplus >= 201103L
180 template<
typename _Tp1>
181 __attribute__((__always_inline__))
185 __attribute__((__always_inline__))
186 #if __cpp_constexpr_dynamic_alloc
191 #if __cpp_constexpr_dynamic_alloc
192 [[nodiscard,__gnu__::__always_inline__]]
197 if constexpr (
requires {
sizeof(_Tp); })
199 if (std::__is_constant_evaluated())
201 if (__builtin_mul_overflow(__n,
sizeof(_Tp), &__n))
202 std::__throw_bad_array_new_length();
203 return static_cast<_Tp*
>(::operator
new(__n));
209 [[__gnu__::__always_inline__]]
211 deallocate(_Tp* __p,
size_t __n)
213 if (std::__is_constant_evaluated())
215 ::operator
delete(__p);
222 #ifdef __glibcxx_allocate_at_least
223 [[nodiscard]] constexpr allocation_result<_Tp*, size_t>
224 allocate_at_least(
size_t __n)
225 {
return { this->allocate(__n), __n }; }
228 friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR
233 #if __cpp_impl_three_way_comparison < 201907L
234 friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR
248 template<
typename _T1,
typename _T2>
249 __attribute__((__always_inline__))
250 inline _GLIBCXX20_CONSTEXPR
bool
255 #if __cpp_impl_three_way_comparison < 201907L
256 template<
typename _T1,
typename _T2>
257 __attribute__((__always_inline__))
258 inline _GLIBCXX20_CONSTEXPR
bool
268 template<
typename _Tp>
269 class allocator<const _Tp>
272 typedef _Tp value_type;
274 template<
typename _Up> allocator(
const allocator<_Up>&) { }
277 template<
typename _Tp>
278 class allocator<volatile _Tp>
281 typedef _Tp value_type;
283 template<
typename _Up> allocator(
const allocator<_Up>&) { }
286 template<
typename _Tp>
287 class allocator<const volatile _Tp>
290 typedef _Tp value_type;
292 template<
typename _Up> allocator(
const allocator<_Up>&) { }
300 #if _GLIBCXX_EXTERN_TEMPLATE
301 extern template class allocator<char>;
302 extern template class allocator<wchar_t>;
306 #undef __allocator_base
308 _GLIBCXX_END_NAMESPACE_VERSION
311 #pragma GCC diagnostic pop
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
constexpr bool operator==(const allocator< _T1 > &, const allocator< _T2 > &) noexcept
ISO C++ entities toplevel namespace is std.
The standard allocator, as per C++03 [20.4.1].
An allocator that uses global new, as per C++03 [20.4.1].