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
75 typedef void value_type;
76 typedef size_t size_type;
77 typedef ptrdiff_t difference_type;
79 #if __cplusplus <= 201703L
81 typedef void* pointer;
82 typedef const void* const_pointer;
84 template<
typename _Tp1>
89 #if __cplusplus >= 201103L
95 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
98 #if __cplusplus >= 202002L
104 template<
typename _Up>
123 template<
typename _Tp>
127 typedef _Tp value_type;
128 typedef size_t size_type;
129 typedef ptrdiff_t difference_type;
131 #if __cplusplus <= 201703L
133 typedef _Tp* pointer;
134 typedef const _Tp* const_pointer;
135 typedef _Tp& reference;
136 typedef const _Tp& const_reference;
138 template<
typename _Tp1>
143 #if __cplusplus >= 201103L
149 _GLIBCXX20_DEPRECATED_SUGGEST(
"std::allocator_traits::is_always_equal")
162 #if __cplusplus >= 201103L
167 template<
typename _Tp1>
171 #if __cpp_constexpr_dynamic_alloc
176 #if __cplusplus > 201703L
177 [[nodiscard,__gnu__::__always_inline__]]
181 if (std::__is_constant_evaluated())
182 return static_cast<_Tp*
>(::operator
new(__n *
sizeof(_Tp)));
186 [[__gnu__::__always_inline__]]
188 deallocate(_Tp* __p,
size_t __n)
190 if (std::__is_constant_evaluated())
192 ::operator
delete(__p);
199 friend _GLIBCXX20_CONSTEXPR
bool
203 #if __cpp_impl_three_way_comparison < 201907L
204 friend _GLIBCXX20_CONSTEXPR
bool
212 template<
typename _T1,
typename _T2>
213 inline _GLIBCXX20_CONSTEXPR
bool
218 #if __cpp_impl_three_way_comparison < 201907L
219 template<
typename _T1,
typename _T2>
220 inline _GLIBCXX20_CONSTEXPR
bool
221 operator!=(
const allocator<_T1>&,
const allocator<_T2>&)
228 template<
typename _Tp>
229 class allocator<const _Tp>
232 typedef _Tp value_type;
233 template<
typename _Up> allocator(
const allocator<_Up>&) { }
236 template<
typename _Tp>
237 class allocator<volatile _Tp>
240 typedef _Tp value_type;
241 template<
typename _Up> allocator(
const allocator<_Up>&) { }
244 template<
typename _Tp>
245 class allocator<const volatile _Tp>
248 typedef _Tp value_type;
249 template<
typename _Up> allocator(
const allocator<_Up>&) { }
256 #if _GLIBCXX_EXTERN_TEMPLATE
257 extern template class allocator<char>;
258 extern template class allocator<wchar_t>;
262 #undef __allocator_base
265 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
267 {
static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } };
269 template<
typename _Alloc>
270 struct __alloc_swap<_Alloc, false>
273 _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT
282 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
286 _S_do_it(
const _Alloc&,
const _Alloc&)
290 template<
typename _Alloc>
291 struct __alloc_neq<_Alloc, false>
294 _S_do_it(
const _Alloc& __one,
const _Alloc& __two)
295 {
return __one != __two; }
298 #if __cplusplus >= 201103L
299 template<
typename _Tp,
bool
300 = __or_<is_copy_constructible<typename _Tp::value_type>,
301 is_nothrow_move_constructible<typename _Tp::value_type>>::value>
302 struct __shrink_to_fit_aux
303 {
static bool _S_do_it(_Tp&) noexcept {
return false; } };
305 template<
typename _Tp>
306 struct __shrink_to_fit_aux<_Tp, true>
310 _S_do_it(_Tp& __c) noexcept
315 _Tp(__make_move_if_noexcept_iterator(__c.begin()),
316 __make_move_if_noexcept_iterator(__c.end()),
317 __c.get_allocator()).swap(__c);
329 _GLIBCXX_END_NAMESPACE_VERSION