30 #ifndef _NEW_ALLOCATOR_H
31 #define _NEW_ALLOCATOR_H 1
38 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
40 _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 template<
typename _Tp>
57 typedef size_t size_type;
58 typedef ptrdiff_t difference_type;
60 typedef const _Tp* const_pointer;
61 typedef _Tp& reference;
62 typedef const _Tp& const_reference;
63 typedef _Tp value_type;
65 template<
typename _Tp1>
73 template<
typename _Tp1>
79 address(reference __x)
const {
return std::__addressof(__x); }
82 address(const_reference __x)
const {
return std::__addressof(__x); }
87 allocate(size_type __n,
const void* = 0)
89 if (__n > this->max_size())
90 std::__throw_bad_alloc();
92 return static_cast<_Tp*
>(::operator
new(__n *
sizeof(_Tp)));
97 deallocate(pointer __p, size_type)
98 { ::operator
delete(__p); }
101 max_size()
const throw()
102 {
return size_t(-1) /
sizeof(_Tp); }
107 construct(pointer __p,
const _Tp& __val)
108 { ::new((
void *)__p) _Tp(__val); }
110 #ifdef __GXX_EXPERIMENTAL_CXX0X__
111 template<
typename... _Args>
113 construct(pointer __p, _Args&&... __args)
114 { ::new((
void *)__p) _Tp(std::forward<_Args>(__args)...); }
118 destroy(pointer __p) { __p->~_Tp(); }
121 template<
typename _Tp>
126 template<
typename _Tp>
128 operator!=(
const new_allocator<_Tp>&,
const new_allocator<_Tp>&)
131 _GLIBCXX_END_NAMESPACE_VERSION
An allocator that uses global new, as per [20.4].This is precisely the allocator defined in the C++ S...