44 #define _ALLOCATOR_H 1
48 #if __cplusplus >= 201103L
52 #define __cpp_lib_incomplete_container_elements 201505
53 #if __cplusplus >= 201103L
54 # define __cpp_lib_allocator_is_always_equal 201411
57 namespace std _GLIBCXX_VISIBILITY(default)
59 _GLIBCXX_BEGIN_NAMESPACE_VERSION
71 typedef void value_type;
72 typedef size_t size_type;
73 typedef ptrdiff_t difference_type;
74 #if __cplusplus <= 201703L
75 typedef void* pointer;
76 typedef const void* const_pointer;
78 template<
typename _Tp1>
84 template<
typename _Up>
89 #if __cplusplus >= 201103L && __cplusplus <= 201703L
96 template<
typename _Up,
typename... _Args>
98 construct(_Up* __p, _Args&&... __args)
99 noexcept(noexcept(::
new((
void *)__p)
100 _Up(std::forward<_Args>(__args)...)))
101 { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
103 template<
typename _Up>
106 noexcept(noexcept(__p->~_Up()))
108 #endif // C++11 to C++17
119 template<
typename _Tp>
123 typedef _Tp value_type;
124 typedef size_t size_type;
125 typedef ptrdiff_t difference_type;
126 #if __cplusplus <= 201703L
127 typedef _Tp* pointer;
128 typedef const _Tp* const_pointer;
129 typedef _Tp& reference;
130 typedef const _Tp& const_reference;
132 template<
typename _Tp1>
137 #if __cplusplus >= 201103L
154 #if __cplusplus >= 201103L
159 template<
typename _Tp1>
163 #if __cpp_constexpr_dynamic_alloc
168 #if __cplusplus > 201703L
169 [[nodiscard,__gnu__::__always_inline__]]
173 #ifdef __cpp_lib_is_constant_evaluated
174 if (std::is_constant_evaluated())
175 return static_cast<_Tp*
>(::operator
new(__n *
sizeof(_Tp)));
180 [[__gnu__::__always_inline__]]
182 deallocate(_Tp* __p,
size_t __n)
184 #ifdef __cpp_lib_is_constant_evaluated
185 if (std::is_constant_evaluated())
187 ::operator
delete(__p);
195 friend _GLIBCXX20_CONSTEXPR
bool
199 friend _GLIBCXX20_CONSTEXPR
bool
206 template<
typename _T1,
typename _T2>
207 inline _GLIBCXX20_CONSTEXPR
bool
212 template<
typename _T1,
typename _T2>
213 inline _GLIBCXX20_CONSTEXPR
bool
214 operator!=(
const allocator<_T1>&,
const allocator<_T2>&)
220 template<
typename _Tp>
221 class allocator<const _Tp>
224 typedef _Tp value_type;
225 template<
typename _Up> allocator(
const allocator<_Up>&) { }
228 template<
typename _Tp>
229 class allocator<volatile _Tp>
232 typedef _Tp value_type;
233 template<
typename _Up> allocator(
const allocator<_Up>&) { }
236 template<
typename _Tp>
237 class allocator<const volatile _Tp>
240 typedef _Tp value_type;
241 template<
typename _Up> allocator(
const allocator<_Up>&) { }
248 #if _GLIBCXX_EXTERN_TEMPLATE
249 extern template class allocator<char>;
250 extern template class allocator<wchar_t>;
254 #undef __allocator_base
257 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
259 {
static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } };
261 template<
typename _Alloc>
262 struct __alloc_swap<_Alloc, false>
265 _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT
274 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
278 _S_do_it(
const _Alloc&,
const _Alloc&)
282 template<
typename _Alloc>
283 struct __alloc_neq<_Alloc, false>
286 _S_do_it(
const _Alloc& __one,
const _Alloc& __two)
287 {
return __one != __two; }
290 #if __cplusplus >= 201103L
291 template<
typename _Tp,
bool
292 = __or_<is_copy_constructible<typename _Tp::value_type>,
293 is_nothrow_move_constructible<typename _Tp::value_type>>::value>
294 struct __shrink_to_fit_aux
295 {
static bool _S_do_it(_Tp&) noexcept {
return false; } };
297 template<
typename _Tp>
298 struct __shrink_to_fit_aux<_Tp, true>
301 _S_do_it(_Tp& __c) noexcept
306 _Tp(__make_move_if_noexcept_iterator(__c.begin()),
307 __make_move_if_noexcept_iterator(__c.end()),
308 __c.get_allocator()).swap(__c);
320 _GLIBCXX_END_NAMESPACE_VERSION