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 _GLIBCXX_NOEXCEPT
83 address(const_reference __x)
const _GLIBCXX_NOEXCEPT
89 allocate(size_type __n,
const void* = 0)
91 if (__n > this->max_size())
92 std::__throw_bad_alloc();
94 return static_cast<_Tp*
>(::operator
new(__n *
sizeof(_Tp)));
99 deallocate(pointer __p, size_type)
100 { ::operator
delete(__p); }
103 max_size()
const _GLIBCXX_USE_NOEXCEPT
104 {
return size_t(-1) /
sizeof(_Tp); }
106 #ifdef __GXX_EXPERIMENTAL_CXX0X__
107 template<
typename _Up,
typename... _Args>
109 construct(_Up* __p, _Args&&... __args)
110 { ::new((
void *)__p) _Up(std::forward<_Args>(__args)...); }
112 template<
typename _Up>
114 destroy(_Up* __p) { __p->~_Up(); }
119 construct(pointer __p,
const _Tp& __val)
120 { ::new((
void *)__p) _Tp(__val); }
123 destroy(pointer __p) { __p->~_Tp(); }
127 template<
typename _Tp>
132 template<
typename _Tp>
134 operator!=(
const new_allocator<_Tp>&,
const new_allocator<_Tp>&)
137 _GLIBCXX_END_NAMESPACE_VERSION