44 #define _ALLOCATOR_H 1
48 #if __cplusplus >= 201103L
52 #define __cpp_lib_incomplete_container_elements 201505
54 namespace std _GLIBCXX_VISIBILITY(default)
56 _GLIBCXX_BEGIN_NAMESPACE_VERSION
69 #if ! _GLIBCXX_INLINE_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
96 #if __cplusplus > 201703L
99 template<
typename _Up>
109 template<
typename _Up,
typename... _Args>
111 construct(_Up* __p, _Args&&... __args)
113 { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
115 template<
typename _Up>
133 template<
typename _Tp>
137 typedef _Tp value_type;
138 typedef size_t size_type;
139 typedef ptrdiff_t difference_type;
141 #if __cplusplus <= 201703L
143 typedef _Tp* pointer;
144 typedef const _Tp* const_pointer;
145 typedef _Tp& reference;
146 typedef const _Tp& const_reference;
148 template<
typename _Tp1>
153 #if __cplusplus >= 201103L
170 #if __cplusplus >= 201103L
175 template<
typename _Tp1>
179 #if __cpp_constexpr_dynamic_alloc
184 #if __cplusplus > 201703L
185 [[nodiscard,__gnu__::__always_inline__]]
189 #ifdef __cpp_lib_is_constant_evaluated
190 if (std::is_constant_evaluated())
191 return static_cast<_Tp*
>(::operator
new(__n *
sizeof(_Tp)));
196 [[__gnu__::__always_inline__]]
198 deallocate(_Tp* __p,
size_t __n)
200 #ifdef __cpp_lib_is_constant_evaluated
201 if (std::is_constant_evaluated())
203 ::operator
delete(__p);
211 friend _GLIBCXX20_CONSTEXPR
bool
215 #if __cpp_impl_three_way_comparison < 201907L
216 friend _GLIBCXX20_CONSTEXPR
bool
224 template<
typename _T1,
typename _T2>
225 inline _GLIBCXX20_CONSTEXPR
bool
230 #if __cpp_impl_three_way_comparison < 201907L
231 template<
typename _T1,
typename _T2>
232 inline _GLIBCXX20_CONSTEXPR
bool
233 operator!=(
const allocator<_T1>&,
const allocator<_T2>&)
240 template<
typename _Tp>
241 class allocator<const _Tp>
244 typedef _Tp value_type;
245 template<
typename _Up> allocator(
const allocator<_Up>&) { }
248 template<
typename _Tp>
249 class allocator<volatile _Tp>
252 typedef _Tp value_type;
253 template<
typename _Up> allocator(
const allocator<_Up>&) { }
256 template<
typename _Tp>
257 class allocator<const volatile _Tp>
260 typedef _Tp value_type;
261 template<
typename _Up> allocator(
const allocator<_Up>&) { }
268 #if _GLIBCXX_EXTERN_TEMPLATE
269 extern template class allocator<char>;
270 extern template class allocator<wchar_t>;
274 #undef __allocator_base
277 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
279 {
static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } };
281 template<
typename _Alloc>
282 struct __alloc_swap<_Alloc, false>
285 _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT
294 template<
typename _Alloc,
bool = __is_empty(_Alloc)>
298 _S_do_it(
const _Alloc&,
const _Alloc&)
302 template<
typename _Alloc>
303 struct __alloc_neq<_Alloc, false>
306 _S_do_it(
const _Alloc& __one,
const _Alloc& __two)
307 {
return __one != __two; }
310 #if __cplusplus >= 201103L
311 template<
typename _Tp,
bool
312 = __or_<is_copy_constructible<typename _Tp::value_type>,
313 is_nothrow_move_constructible<typename _Tp::value_type>>::value>
314 struct __shrink_to_fit_aux
315 {
static bool _S_do_it(_Tp&) noexcept {
return false; } };
317 template<
typename _Tp>
318 struct __shrink_to_fit_aux<_Tp, true>
321 _S_do_it(_Tp& __c) noexcept
326 _Tp(__make_move_if_noexcept_iterator(__c.begin()),
327 __make_move_if_noexcept_iterator(__c.end()),
328 __c.get_allocator()).swap(__c);
340 _GLIBCXX_END_NAMESPACE_VERSION
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].