29 #ifndef _EXT_ALLOC_TRAITS_H
30 #define _EXT_ALLOC_TRAITS_H 1
32 #pragma GCC system_header
34 #ifdef __GXX_EXPERIMENTAL_CXX0X__
40 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
43 template<
typename>
struct allocator;
44 _GLIBCXX_END_NAMESPACE_VERSION
47 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
51 #ifdef __GXX_EXPERIMENTAL_CXX0X__
52 template<
typename _Alloc>
53 struct __allocator_always_compares_equal
54 {
static const bool value =
false; };
56 template<
typename _Alloc>
57 const bool __allocator_always_compares_equal<_Alloc>::value;
59 template<
typename _Tp>
60 struct __allocator_always_compares_equal<std::allocator<_Tp>>
61 {
static const bool value =
true; };
63 template<
typename _Tp>
64 const bool __allocator_always_compares_equal<std::allocator<_Tp>>::value;
68 template<
typename _Tp,
typename _Array>
70 {
static const bool value =
true; };
72 template<
typename _Tp,
typename _Array>
74 __allocator_always_compares_equal<array_allocator<_Tp, _Array>>::value;
76 template<
typename>
struct mt_allocator;
78 template<
typename _Tp>
79 struct __allocator_always_compares_equal<mt_allocator<_Tp>>
80 {
static const bool value =
true; };
82 template<
typename _Tp>
83 const bool __allocator_always_compares_equal<mt_allocator<_Tp>>::value;
87 template<
typename _Tp>
89 {
static const bool value =
true; };
91 template<
typename _Tp>
92 const bool __allocator_always_compares_equal<new_allocator<_Tp>>::value;
94 template<
typename>
struct pool_allocator;
96 template<
typename _Tp>
97 struct __allocator_always_compares_equal<pool_allocator<_Tp>>
98 {
static const bool value =
true; };
100 template<
typename _Tp>
101 const bool __allocator_always_compares_equal<pool_allocator<_Tp>>::value;
108 template<
typename _Alloc>
110 #ifdef __GXX_EXPERIMENTAL_CXX0X__
115 #ifdef __GXX_EXPERIMENTAL_CXX0X__
131 template<
typename _Ptr>
132 struct __is_custom_pointer
134 && !std::is_pointer<_Ptr>::value>
139 template<
typename _Ptr,
typename... _Args>
141 construct(_Alloc& __a, _Ptr __p, _Args&&... __args)
144 std::forward<_Args>(__args)...);
148 template<
typename _Ptr>
150 destroy(_Alloc& __a, _Ptr __p)
153 static _Alloc _S_select_on_copy(
const _Alloc& __a)
156 static void _S_on_swap(_Alloc& __a, _Alloc& __b)
157 { std::__alloc_on_swap(__a, __b); }
159 static constexpr
bool _S_propagate_on_copy_assign()
160 {
return _Base_type::propagate_on_container_copy_assignment::value; }
162 static constexpr
bool _S_propagate_on_move_assign()
163 {
return _Base_type::propagate_on_container_move_assignment::value; }
165 static constexpr
bool _S_propagate_on_swap()
166 {
return _Base_type::propagate_on_container_swap::value; }
168 static constexpr
bool _S_always_equal()
169 {
return __allocator_always_compares_equal<_Alloc>::value; }
171 static constexpr
bool _S_nothrow_move()
172 {
return _S_propagate_on_move_assign() || _S_always_equal(); }
174 static constexpr
bool _S_nothrow_swap()
177 return !_S_propagate_on_swap()
178 || noexcept(swap(std::declval<_Alloc&>(), std::declval<_Alloc&>()));
181 template<
typename _Tp>
183 {
typedef typename _Base_type::template rebind_alloc<_Tp> other; };
186 typedef typename _Alloc::pointer
pointer;
188 typedef typename _Alloc::value_type
value_type;
189 typedef typename _Alloc::reference reference;
190 typedef typename _Alloc::const_reference const_reference;
191 typedef typename _Alloc::size_type
size_type;
195 {
return __a.allocate(__n); }
198 { __a.deallocate(__p, __n); }
200 template<
typename _Tp>
201 static void construct(_Alloc& __a,
pointer __p,
const _Tp& __arg)
202 { __a.construct(__p, __arg); }
204 static void destroy(_Alloc& __a,
pointer __p)
205 { __a.destroy(__p); }
208 {
return __a.max_size(); }
210 static const _Alloc& _S_select_on_copy(
const _Alloc& __a) {
return __a; }
212 static void _S_on_swap(_Alloc& __a, _Alloc& __b)
216 std::__alloc_swap<_Alloc>::_S_do_it(__a, __b);
219 template<
typename _Tp>
221 {
typedef typename _Alloc::template rebind<_Tp>::other other; };
225 _GLIBCXX_END_NAMESPACE_VERSION