44 #define _ALLOCATOR_H 1 48 #if __cplusplus >= 201103L 52 #define __cpp_lib_incomplete_container_elements 201505L 54 namespace std _GLIBCXX_VISIBILITY(default)
56 _GLIBCXX_BEGIN_NAMESPACE_VERSION
78 typedef void value_type;
79 typedef size_t size_type;
80 typedef ptrdiff_t difference_type;
82 #if __cplusplus <= 201703L 84 typedef void* pointer;
85 typedef const void* const_pointer;
87 template<
typename _Tp1>
92 #if __cplusplus >= 201103L 98 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
101 #if __cplusplus >= 202002L 107 template<
typename _Up>
128 template<
typename _Tp>
132 typedef _Tp value_type;
133 typedef size_t size_type;
134 typedef ptrdiff_t difference_type;
136 #if __cplusplus <= 201703L 138 typedef _Tp* pointer;
139 typedef const _Tp* const_pointer;
140 typedef _Tp& reference;
141 typedef const _Tp& const_reference;
143 template<
typename _Tp1>
148 #if __cplusplus >= 201103L 154 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
165 : __allocator_base<_Tp>(__a) { }
167 #if __cplusplus >= 201103L 172 template<
typename _Tp1>
176 #if __cpp_constexpr_dynamic_alloc 181 #if __cplusplus > 201703L 182 [[nodiscard,__gnu__::__always_inline__]]
186 if (std::__is_constant_evaluated())
188 if (__builtin_mul_overflow(__n,
sizeof(_Tp), &__n))
189 std::__throw_bad_array_new_length();
190 return static_cast<_Tp*
>(::operator
new(__n));
193 return __allocator_base<_Tp>::allocate(__n, 0);
196 [[__gnu__::__always_inline__]]
198 deallocate(_Tp* __p,
size_t __n)
200 if (std::__is_constant_evaluated())
202 ::operator
delete(__p);
205 __allocator_base<_Tp>::deallocate(__p, __n);
209 friend _GLIBCXX20_CONSTEXPR
bool 213 #if __cpp_impl_three_way_comparison < 201907L 214 friend _GLIBCXX20_CONSTEXPR
bool 227 template<
typename _T1,
typename _T2>
228 inline _GLIBCXX20_CONSTEXPR
bool 233 #if __cpp_impl_three_way_comparison < 201907L 234 template<
typename _T1,
typename _T2>
235 inline _GLIBCXX20_CONSTEXPR
bool 245 template<
typename _Tp>
249 typedef _Tp value_type;
254 template<
typename _Tp>
258 typedef _Tp value_type;
263 template<
typename _Tp>
267 typedef _Tp value_type;
276 #if _GLIBCXX_EXTERN_TEMPLATE 282 #undef __allocator_base 285 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
287 {
static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } };
289 template<
typename _Alloc>
290 struct __alloc_swap<_Alloc, false>
293 _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT
302 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
306 _S_do_it(
const _Alloc&,
const _Alloc&)
310 template<
typename _Alloc>
311 struct __alloc_neq<_Alloc, false>
314 _S_do_it(
const _Alloc& __one,
const _Alloc& __two)
315 {
return __one != __two; }
318 #if __cplusplus >= 201103L 319 template<
typename _Tp,
bool 320 = __or_<is_copy_constructible<typename _Tp::value_type>,
322 struct __shrink_to_fit_aux
323 {
static bool _S_do_it(_Tp&) noexcept {
return false; } };
325 template<
typename _Tp>
326 struct __shrink_to_fit_aux<_Tp, true>
330 _S_do_it(_Tp& __c) noexcept
335 _Tp(__make_move_if_noexcept_iterator(__c.begin()),
336 __make_move_if_noexcept_iterator(__c.end()),
337 __c.get_allocator()).swap(__c);
350 _GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator==(const allocator< _T1 > &, const allocator< _T2 > &) noexcept
ISO C++ entities toplevel namespace is std.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
The standard allocator, as per C++03 [20.4.1].
is_nothrow_move_constructible