34 #ifndef _EXTPTR_ALLOCATOR_H
35 #define _EXTPTR_ALLOCATOR_H 1
41 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
51 template<typename _Tp>
55 typedef std::size_t size_type;
56 typedef std::ptrdiff_t difference_type;
63 typedef _Tp& reference;
64 typedef const _Tp& const_reference;
65 typedef _Tp value_type;
67 template<
typename _Up>
71 _ExtPtr_allocator()
throw()
74 _ExtPtr_allocator(
const _ExtPtr_allocator &__rarg)
throw()
75 : _M_real_alloc(__rarg._M_real_alloc) { }
77 template<
typename _Up>
79 : _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
81 ~_ExtPtr_allocator()
throw()
84 pointer address(reference __x)
const
87 const_pointer address(const_reference __x)
const
90 pointer allocate(size_type __n,
void* __hint = 0)
91 {
return _M_real_alloc.allocate(__n,__hint); }
93 void deallocate(pointer __p, size_type __n)
94 { _M_real_alloc.deallocate(__p.get(), __n); }
96 size_type max_size()
const throw()
99 void construct(pointer __p,
const _Tp& __val)
100 { ::new(__p.get()) _Tp(__val); }
102 #ifdef __GXX_EXPERIMENTAL_CXX0X__
103 template<
typename... _Args>
105 construct(pointer __p, _Args&&... __args)
106 { ::new(__p.get()) _Tp(std::forward<_Args>(__args)...); }
109 void destroy(pointer __p)
112 template<
typename _Up>
115 {
return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
118 operator==(
const _ExtPtr_allocator& __rarg)
119 {
return _M_real_alloc == __rarg._M_real_alloc; }
121 template<
typename _Up>
124 {
return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
127 operator!=(
const _ExtPtr_allocator& __rarg)
128 {
return _M_real_alloc != __rarg._M_real_alloc; }
130 template<
typename _Up>
136 _M_getUnderlyingImp()
const
137 {
return _M_real_alloc; }
148 typedef std::size_t size_type;
149 typedef std::ptrdiff_t difference_type;
150 typedef void value_type;
157 template<
typename _Up>
165 template<
typename _Tp>
167 swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg)
170 __rarg._M_real_alloc = __larg._M_real_alloc;
171 __larg._M_real_alloc = __tmp;
174 _GLIBCXX_END_NAMESPACE