48#if __cplusplus >= 201103L
52#define __cpp_lib_incomplete_container_elements 201505L
54namespace 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>
89 {
typedef allocator<_Tp1> other; };
92#if __cplusplus >= 201103L
95 using propagate_on_container_move_assignment =
true_type;
98 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
101#if __cplusplus >= 202002L
104 allocator() =
default;
105 ~allocator() =
default;
107 template<
typename _Up>
109 allocator(
const allocator<_Up>&)
noexcept { }
128 template<
typename _Tp>
129 class allocator :
public __allocator_base<_Tp>
132 typedef _Tp value_type;
133 typedef size_t size_type;
134 typedef ptrdiff_t difference_type;
136#if __cplusplus <= 201703L
139 typedef const _Tp* const_pointer;
140 typedef _Tp& reference;
141 typedef const _Tp& const_reference;
143 template<
typename _Tp1>
145 {
typedef allocator<_Tp1>
other; };
148#if __cplusplus >= 201103L
151 using propagate_on_container_move_assignment = true_type;
153 using is_always_equal
154 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
161 allocator() _GLIBCXX_NOTHROW { }
164 allocator(
const allocator& __a) _GLIBCXX_NOTHROW
165 : __allocator_base<_Tp>(__a) { }
167#if __cplusplus >= 201103L
169 allocator& operator=(
const allocator&) =
default;
172 template<
typename _Tp1>
174 allocator(
const allocator<_Tp1>&) _GLIBCXX_NOTHROW { }
176#if __cpp_constexpr_dynamic_alloc
179 ~allocator() _GLIBCXX_NOTHROW { }
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
210 operator==(
const allocator&,
const allocator&) _GLIBCXX_NOTHROW
213#if __cpp_impl_three_way_comparison < 201907L
214 friend _GLIBCXX20_CONSTEXPR
bool
215 operator!=(
const allocator&,
const allocator&) _GLIBCXX_NOTHROW
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>
246 class allocator<const _Tp>
249 typedef _Tp value_type;
251 template<
typename _Up> allocator(
const allocator<_Up>&) { }
254 template<
typename _Tp>
258 typedef _Tp value_type;
260 template<
typename _Up> allocator(
const allocator<_Up>&) { }
263 template<
typename _Tp>
267 typedef _Tp value_type;
269 template<
typename _Up> allocator(
const allocator<_Up>&) { }
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
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
constexpr bool operator==(const allocator< _T1 > &, const allocator< _T2 > &) noexcept
ISO C++ entities toplevel namespace is std.
is_nothrow_move_constructible
The standard allocator, as per C++03 [20.4.1].