Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/container/allocator_traits.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
4 // Software License, Version 1.0. (See accompanying file | 4 // Software License, Version 1.0. (See accompanying file |
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
6 // | 6 // |
7 ////////////////////////////////////////////////////////////////////////////// | 7 ////////////////////////////////////////////////////////////////////////////// |
8 // | 8 // |
9 // (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost | 9 // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost |
10 // Software License, Version 1.0. (See accompanying file | 10 // Software License, Version 1.0. (See accompanying file |
11 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | 11 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
12 // | 12 // |
13 // See http://www.boost.org/libs/container for documentation. | 13 // See http://www.boost.org/libs/container for documentation. |
14 // | 14 // |
15 ////////////////////////////////////////////////////////////////////////////// | 15 ////////////////////////////////////////////////////////////////////////////// |
16 | |
17 #ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP | 16 #ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP |
18 #define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP | 17 #define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP |
19 | 18 |
20 #if defined(_MSC_VER) | 19 #ifndef BOOST_CONFIG_HPP |
20 # include <boost/config.hpp> | |
21 #endif | |
22 | |
23 #if defined(BOOST_HAS_PRAGMA_ONCE) | |
21 # pragma once | 24 # pragma once |
22 #endif | 25 #endif |
23 | 26 |
24 #include <boost/container/detail/config_begin.hpp> | 27 #include <boost/container/detail/config_begin.hpp> |
25 #include <boost/container/detail/workaround.hpp> | 28 #include <boost/container/detail/workaround.hpp> |
29 | |
30 // container | |
26 #include <boost/container/container_fwd.hpp> | 31 #include <boost/container/container_fwd.hpp> |
32 #include <boost/container/detail/mpl.hpp> | |
33 #include <boost/container/detail/type_traits.hpp> //is_empty | |
34 #include <boost/container/detail/placement_new.hpp> | |
35 #ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP | |
36 #include <boost/container/detail/std_fwd.hpp> | |
37 #endif | |
38 // intrusive | |
27 #include <boost/intrusive/pointer_traits.hpp> | 39 #include <boost/intrusive/pointer_traits.hpp> |
28 #include <boost/intrusive/detail/memory_util.hpp> | 40 #include <boost/intrusive/detail/mpl.hpp> |
29 #include <boost/container/detail/memory_util.hpp> | 41 // move |
30 #include <boost/type_traits/integral_constant.hpp> | 42 #include <boost/move/utility_core.hpp> |
31 #include <boost/container/detail/mpl.hpp> | 43 // move/detail |
32 #include <boost/move/utility.hpp> | |
33 #include <limits> //numeric_limits<>::max() | |
34 #include <new> //placement new | |
35 #include <memory> //std::allocator | |
36 | |
37 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | 44 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) |
38 #include <boost/container/detail/preprocessor.hpp> | 45 #include <boost/move/detail/fwd_macros.hpp> |
39 #endif | 46 #endif |
40 | 47 // other boost |
41 ///@cond | 48 #include <boost/static_assert.hpp> |
49 | |
50 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
51 | |
52 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate | |
53 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { | |
54 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} | |
55 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 2 | |
56 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 2 | |
57 #include <boost/intrusive/detail/has_member_function_callable_with.hpp> | |
58 | |
59 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy | |
60 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { | |
61 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} | |
62 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 | |
63 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 | |
64 #include <boost/intrusive/detail/has_member_function_callable_with.hpp> | |
65 | |
66 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct | |
67 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { | |
68 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} | |
69 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 | |
70 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 9 | |
71 #include <boost/intrusive/detail/has_member_function_callable_with.hpp> | |
72 | |
73 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
42 | 74 |
43 namespace boost { | 75 namespace boost { |
44 namespace container { | 76 namespace container { |
77 | |
78 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED | |
79 | |
80 namespace allocator_traits_detail { | |
81 | |
82 BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_max_size, max_size) | |
83 BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_select_on_container_copy_construction, select_on_container_copy_construction) | |
84 | |
85 } //namespace allocator_traits_detail { | |
86 | |
45 namespace container_detail { | 87 namespace container_detail { |
46 | 88 |
47 //workaround needed for C++03 compilers with no construct() | 89 //workaround needed for C++03 compilers with no construct() |
48 //supporting rvalue references | 90 //supporting rvalue references |
49 template<class A> | 91 template<class Allocator> |
50 struct is_std_allocator | 92 struct is_std_allocator |
51 { static const bool value = false; }; | 93 { static const bool value = false; }; |
52 | 94 |
53 template<class T> | 95 template<class T> |
54 struct is_std_allocator< std::allocator<T> > | 96 struct is_std_allocator< std::allocator<T> > |
55 { static const bool value = true; }; | 97 { static const bool value = true; }; |
56 | 98 |
99 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) | |
100 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_pointer) | |
101 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference) | |
102 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference) | |
103 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(void_pointer) | |
104 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_void_pointer) | |
105 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type) | |
106 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment) | |
107 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment) | |
108 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap) | |
109 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_always_equal) | |
110 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) | |
111 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_partially_propagable) | |
112 | |
57 } //namespace container_detail { | 113 } //namespace container_detail { |
58 | 114 |
59 ///@endcond | 115 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED |
60 | 116 |
61 //! The class template allocator_traits supplies a uniform interface to all allocator types. | 117 //! The class template allocator_traits supplies a uniform interface to all allocator types. |
62 //! This class is a C++03-compatible implementation of std::allocator_traits | 118 //! This class is a C++03-compatible implementation of std::allocator_traits |
63 template <typename Alloc> | 119 template <typename Allocator> |
64 struct allocator_traits | 120 struct allocator_traits |
65 { | 121 { |
66 //allocator_type | 122 //allocator_type |
67 typedef Alloc allocator_type; | 123 typedef Allocator allocator_type; |
68 //value_type | 124 //value_type |
69 typedef typename Alloc::value_type value_type; | 125 typedef typename allocator_type::value_type value_type; |
70 | 126 |
71 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | 127 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) |
72 //! Alloc::pointer if such a type exists; otherwise, value_type* | 128 //! Allocator::pointer if such a type exists; otherwise, value_type* |
73 //! | 129 //! |
74 typedef unspecified pointer; | 130 typedef unspecified pointer; |
75 //! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const | 131 //! Allocator::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const |
76 //! | 132 //! |
77 typedef see_documentation const_pointer; | 133 typedef see_documentation const_pointer; |
78 //! Non-standard extension | 134 //! Non-standard extension |
79 //! Alloc::reference if such a type exists; otherwise, value_type& | 135 //! Allocator::reference if such a type exists; otherwise, value_type& |
80 typedef see_documentation reference; | 136 typedef see_documentation reference; |
81 //! Non-standard extension | 137 //! Non-standard extension |
82 //! Alloc::const_reference if such a type exists ; otherwise, const value_type& | 138 //! Allocator::const_reference if such a type exists ; otherwise, const value_type& |
83 typedef see_documentation const_reference; | 139 typedef see_documentation const_reference; |
84 //! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>. | 140 //! Allocator::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>. |
85 //! | 141 //! |
86 typedef see_documentation void_pointer; | 142 typedef see_documentation void_pointer; |
87 //! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const | 143 //! Allocator::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const |
88 //! | 144 //! |
89 typedef see_documentation const_void_pointer; | 145 typedef see_documentation const_void_pointer; |
90 //! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type. | 146 //! Allocator::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type. |
91 //! | 147 //! |
92 typedef see_documentation difference_type; | 148 typedef see_documentation difference_type; |
93 //! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type | 149 //! Allocator::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type |
94 //! | 150 //! |
95 typedef see_documentation size_type; | 151 typedef see_documentation size_type; |
96 //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant | 152 //! Allocator::propagate_on_container_copy_assignment if such a type exists, otherwise a type |
97 //! type with internal constant static member `value` == false. | 153 //! with an internal constant static boolean member <code>value</code> == false. |
98 typedef see_documentation propagate_on_container_copy_assignment; | 154 typedef see_documentation propagate_on_container_copy_assignment; |
99 //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant | 155 //! Allocator::propagate_on_container_move_assignment if such a type exists, otherwise a type |
100 //! type with internal constant static member `value` == false. | 156 //! with an internal constant static boolean member <code>value</code> == false. |
101 typedef see_documentation propagate_on_container_move_assignment; | 157 typedef see_documentation propagate_on_container_move_assignment; |
102 //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant | 158 //! Allocator::propagate_on_container_swap if such a type exists, otherwise a type |
103 //! type with internal constant static member `value` == false. | 159 //! with an internal constant static boolean member <code>value</code> == false. |
104 typedef see_documentation propagate_on_container_swap; | 160 typedef see_documentation propagate_on_container_swap; |
105 //! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args> | 161 //! Allocator::is_always_equal if such a type exists, otherwise a type |
106 //! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or | 162 //! with an internal constant static boolean member <code>value</code> == is_empty<Allocator>::value |
163 typedef see_documentation is_always_equal; | |
164 //! Allocator::is_partially_propagable if such a type exists, otherwise a type | |
165 //! with an internal constant static boolean member <code>value</code> == false | |
166 //! <b>Note</b>: Non-standard extension used to implement `small_vector_allocator`. | |
167 typedef see_documentation is_partially_propagable; | |
168 //! Defines an allocator: Allocator::rebind<T>::other if such a type exists; otherwise, Allocator<T, Args> | |
169 //! if Allocator is a class template instantiation of the form Allocator<U, Args>, where Args is zero or | |
107 //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. | 170 //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. |
108 //! | 171 //! |
109 //! In C++03 compilers `rebind_alloc` is a struct derived from an allocator | 172 //! In C++03 compilers <code>rebind_alloc</code> is a struct derived from an allocator |
110 //! deduced by previously detailed rules. | 173 //! deduced by previously detailed rules. |
111 template <class T> using rebind_alloc = see_documentation; | 174 template <class T> using rebind_alloc = see_documentation; |
112 | 175 |
113 //! In C++03 compilers `rebind_traits` is a struct derived from | 176 //! In C++03 compilers <code>rebind_traits</code> is a struct derived from |
114 //! `allocator_traits<OtherAlloc>`, where `OtherAlloc` is | 177 //! <code>allocator_traits<OtherAlloc></code>, where <code>OtherAlloc</code> is |
115 //! the allocator deduced by rules explained in `rebind_alloc`. | 178 //! the allocator deduced by rules explained in <code>rebind_alloc</code>. |
116 template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >; | 179 template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >; |
117 | 180 |
118 //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers. | 181 //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers. |
119 //! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`. | 182 //! <code>type</code> is an allocator related to Allocator deduced deduced by rules explained in <code>rebind_alloc</code>. |
120 template <class T> | 183 template <class T> |
121 struct portable_rebind_alloc | 184 struct portable_rebind_alloc |
122 { typedef see_documentation type; }; | 185 { typedef see_documentation type; }; |
123 #else | 186 #else |
124 //pointer | 187 //pointer |
125 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 188 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
126 pointer, value_type*) | 189 pointer, value_type*) |
127 pointer; | 190 pointer; |
128 //const_pointer | 191 //const_pointer |
129 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, | 192 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator, |
130 const_pointer, typename boost::intrusive::pointer_traits<pointer>::template | 193 const_pointer, typename boost::intrusive::pointer_traits<pointer>::template |
131 rebind_pointer<const value_type>) | 194 rebind_pointer<const value_type>) |
132 const_pointer; | 195 const_pointer; |
133 //reference | 196 //reference |
134 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 197 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
135 reference, typename container_detail::unvoid<value_type>::type&) | 198 reference, typename container_detail::unvoid<value_type>::type&) |
136 reference; | 199 reference; |
137 //const_reference | 200 //const_reference |
138 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 201 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
139 const_reference, const typename container_detail::unvoid<value_type>::type&) | 202 const_reference, const typename container_detail::unvoid<value_type>::type&) |
140 const_reference; | 203 const_reference; |
141 //void_pointer | 204 //void_pointer |
142 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, | 205 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator, |
143 void_pointer, typename boost::intrusive::pointer_traits<pointer>::template | 206 void_pointer, typename boost::intrusive::pointer_traits<pointer>::template |
144 rebind_pointer<void>) | 207 rebind_pointer<void>) |
145 void_pointer; | 208 void_pointer; |
146 //const_void_pointer | 209 //const_void_pointer |
147 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, | 210 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator, |
148 const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template | 211 const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template |
149 rebind_pointer<const void>) | 212 rebind_pointer<const void>) |
150 const_void_pointer; | 213 const_void_pointer; |
151 //difference_type | 214 //difference_type |
152 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 215 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
153 difference_type, std::ptrdiff_t) | 216 difference_type, std::ptrdiff_t) |
154 difference_type; | 217 difference_type; |
155 //size_type | 218 //size_type |
156 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 219 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
157 size_type, std::size_t) | 220 size_type, std::size_t) |
158 size_type; | 221 size_type; |
159 //propagate_on_container_copy_assignment | 222 //propagate_on_container_copy_assignment |
160 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 223 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
161 propagate_on_container_copy_assignment, boost::false_type) | 224 propagate_on_container_copy_assignment, container_detail::false_type) |
162 propagate_on_container_copy_assignment; | 225 propagate_on_container_copy_assignment; |
163 //propagate_on_container_move_assignment | 226 //propagate_on_container_move_assignment |
164 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 227 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
165 propagate_on_container_move_assignment, boost::false_type) | 228 propagate_on_container_move_assignment, container_detail::false_type) |
166 propagate_on_container_move_assignment; | 229 propagate_on_container_move_assignment; |
167 //propagate_on_container_swap | 230 //propagate_on_container_swap |
168 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, | 231 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, |
169 propagate_on_container_swap, boost::false_type) | 232 propagate_on_container_swap, container_detail::false_type) |
170 propagate_on_container_swap; | 233 propagate_on_container_swap; |
171 | 234 //is_always_equal |
235 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, | |
236 is_always_equal, container_detail::is_empty<Allocator>) | |
237 is_always_equal; | |
238 //is_partially_propagable | |
239 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, | |
240 is_partially_propagable, container_detail::false_type) | |
241 is_partially_propagable; | |
242 | |
243 //rebind_alloc & rebind_traits | |
172 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) | 244 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) |
173 //C++11 | 245 //C++11 |
174 template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder<Alloc, T>::type; | 246 template <typename T> using rebind_alloc = typename boost::intrusive::pointer_rebind<Allocator, T>::type; |
175 template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; | 247 template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; |
176 #else // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) | 248 #else // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) |
177 //Some workaround for C++03 or C++11 compilers with no template aliases | 249 //Some workaround for C++03 or C++11 compilers with no template aliases |
178 template <typename T> | 250 template <typename T> |
179 struct rebind_alloc : boost::intrusive::detail::type_rebinder<Alloc,T>::type | 251 struct rebind_alloc : boost::intrusive::pointer_rebind<Allocator,T>::type |
180 { | 252 { |
181 typedef typename boost::intrusive::detail::type_rebinder<Alloc,T>::type Base; | 253 typedef typename boost::intrusive::pointer_rebind<Allocator,T>::type Base; |
182 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | 254 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) |
183 template <typename... Args> | 255 template <typename... Args> |
184 rebind_alloc(BOOST_FWD_REF(Args)... args) | 256 rebind_alloc(BOOST_FWD_REF(Args)... args) : Base(boost::forward<Args>(args)...) {} |
185 : Base(boost::forward<Args>(args)...) | |
186 {} | |
187 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | 257 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) |
188 #define BOOST_PP_LOCAL_MACRO(n) \ | 258 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC(N) \ |
189 BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ | 259 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ |
190 rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ | 260 explicit rebind_alloc(BOOST_MOVE_UREF##N) : Base(BOOST_MOVE_FWD##N){}\ |
191 : Base(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ | 261 // |
192 {} \ | 262 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC) |
193 // | 263 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC |
194 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) | |
195 #include BOOST_PP_LOCAL_ITERATE() | |
196 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | 264 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) |
197 }; | 265 }; |
198 | 266 |
199 template <typename T> | 267 template <typename T> |
200 struct rebind_traits | 268 struct rebind_traits |
201 : allocator_traits<typename boost::intrusive::detail::type_rebinder<Alloc, T>::type> | 269 : allocator_traits<typename boost::intrusive::pointer_rebind<Allocator, T>::type> |
202 {}; | 270 {}; |
203 #endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) | 271 #endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) |
272 | |
273 //portable_rebind_alloc | |
204 template <class T> | 274 template <class T> |
205 struct portable_rebind_alloc | 275 struct portable_rebind_alloc |
206 { typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; }; | 276 { typedef typename boost::intrusive::pointer_rebind<Allocator, T>::type type; }; |
207 #endif //BOOST_CONTAINER_DOXYGEN_INVOKED | 277 #endif //BOOST_CONTAINER_DOXYGEN_INVOKED |
208 | 278 |
209 //! <b>Returns</b>: `a.allocate(n)` | 279 //! <b>Returns</b>: <code>a.allocate(n)</code> |
210 //! | 280 //! |
211 static pointer allocate(Alloc &a, size_type n) | 281 static pointer allocate(Allocator &a, size_type n) |
212 { return a.allocate(n); } | 282 { return a.allocate(n); } |
213 | 283 |
214 //! <b>Returns</b>: `a.deallocate(p, n)` | 284 //! <b>Returns</b>: <code>a.deallocate(p, n)</code> |
215 //! | 285 //! |
216 //! <b>Throws</b>: Nothing | 286 //! <b>Throws</b>: Nothing |
217 static void deallocate(Alloc &a, pointer p, size_type n) | 287 static void deallocate(Allocator &a, pointer p, size_type n) |
218 { a.deallocate(p, n); } | 288 { a.deallocate(p, n); } |
219 | 289 |
220 //! <b>Effects</b>: calls `a.allocate(n, p)` if that call is well-formed; | 290 //! <b>Effects</b>: calls <code>a.allocate(n, p)</code> if that call is well-formed; |
221 //! otherwise, invokes `a.allocate(n)` | 291 //! otherwise, invokes <code>a.allocate(n)</code> |
222 static pointer allocate(Alloc &a, size_type n, const_void_pointer p) | 292 static pointer allocate(Allocator &a, size_type n, const_void_pointer p) |
223 { | 293 { |
224 const bool value = boost::container::container_detail:: | 294 const bool value = boost::container::container_detail:: |
225 has_member_function_callable_with_allocate | 295 has_member_function_callable_with_allocate |
226 <Alloc, const size_type, const const_void_pointer>::value; | 296 <Allocator, const size_type, const const_void_pointer>::value; |
227 ::boost::integral_constant<bool, value> flag; | 297 container_detail::bool_<value> flag; |
228 return allocator_traits::priv_allocate(flag, a, n, p); | 298 return allocator_traits::priv_allocate(flag, a, n, p); |
229 } | 299 } |
230 | 300 |
231 //! <b>Effects</b>: calls `a.destroy(p)` if that call is well-formed; | 301 //! <b>Effects</b>: calls <code>a.destroy(p)</code> if that call is well-formed; |
232 //! otherwise, invokes `p->~T()`. | 302 //! otherwise, invokes <code>p->~T()</code>. |
233 template<class T> | 303 template<class T> |
234 static void destroy(Alloc &a, T*p) | 304 static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW |
235 { | 305 { |
236 typedef T* destroy_pointer; | 306 typedef T* destroy_pointer; |
237 const bool value = boost::container::container_detail:: | 307 const bool value = boost::container::container_detail:: |
238 has_member_function_callable_with_destroy | 308 has_member_function_callable_with_destroy |
239 <Alloc, const destroy_pointer>::value; | 309 <Allocator, const destroy_pointer>::value; |
240 ::boost::integral_constant<bool, value> flag; | 310 container_detail::bool_<value> flag; |
241 allocator_traits::priv_destroy(flag, a, p); | 311 allocator_traits::priv_destroy(flag, a, p); |
242 } | 312 } |
243 | 313 |
244 //! <b>Returns</b>: `a.max_size()` if that expression is well-formed; otherwise, | 314 //! <b>Returns</b>: <code>a.max_size()</code> if that expression is well-formed; otherwise, |
245 //! `numeric_limits<size_type>::max()`. | 315 //! <code>numeric_limits<size_type>::max()</code>. |
246 static size_type max_size(const Alloc &a) | 316 static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW |
247 { | 317 { |
248 const bool value = boost::container::container_detail:: | 318 const bool value = allocator_traits_detail::has_max_size<Allocator, size_type (Allocator::*)() const>::value; |
249 has_member_function_callable_with_max_size | 319 container_detail::bool_<value> flag; |
250 <const Alloc>::value; | |
251 ::boost::integral_constant<bool, value> flag; | |
252 return allocator_traits::priv_max_size(flag, a); | 320 return allocator_traits::priv_max_size(flag, a); |
253 } | 321 } |
254 | 322 |
255 //! <b>Returns</b>: `a.select_on_container_copy_construction()` if that expression is well-formed; | 323 //! <b>Returns</b>: <code>a.select_on_container_copy_construction()</code> if that expression is well-formed; |
256 //! otherwise, a. | 324 //! otherwise, a. |
257 static | 325 static BOOST_CONTAINER_DOC1ST(Allocator, |
258 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | 326 typename container_detail::if_c |
259 typename container_detail::if_c | 327 < allocator_traits_detail::has_select_on_container_copy_construction<Allocator BOOST_MOVE_I Allocator (Allocator::*)() const>::value |
260 < boost::container::container_detail:: | 328 BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type) |
261 has_member_function_callable_with_select_on_container_copy_construction | 329 select_on_container_copy_construction(const Allocator &a) |
262 <const Alloc>::value | 330 { |
263 , Alloc | 331 const bool value = allocator_traits_detail::has_select_on_container_copy_construction |
264 , const Alloc & | 332 <Allocator, Allocator (Allocator::*)() const>::value; |
265 >::type | 333 container_detail::bool_<value> flag; |
266 #else | |
267 Alloc | |
268 #endif | |
269 select_on_container_copy_construction(const Alloc &a) | |
270 { | |
271 const bool value = boost::container::container_detail:: | |
272 has_member_function_callable_with_select_on_container_copy_construction | |
273 <const Alloc>::value; | |
274 ::boost::integral_constant<bool, value> flag; | |
275 return allocator_traits::priv_select_on_container_copy_construction(flag, a); | 334 return allocator_traits::priv_select_on_container_copy_construction(flag, a); |
276 } | 335 } |
277 | 336 |
278 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | 337 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) |
279 //! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed; | 338 //! <b>Effects</b>: calls <code>a.construct(p, std::forward<Args>(args)...)</code> if that call is well-formed; |
280 //! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)` | 339 //! otherwise, invokes <code>::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)</code> |
281 template <class T, class ...Args> | 340 template <class T, class ...Args> |
282 static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args) | 341 static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) |
283 { | 342 { |
284 ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; | 343 container_detail::bool_<container_detail::is_std_allocator<Allocator>::value> flag; |
285 allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...); | 344 allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...); |
286 } | 345 } |
287 #endif | 346 #endif |
288 ///@cond | 347 |
348 //! <b>Returns</b>: <code>a.storage_is_unpropagable(p)</code> if is_partially_propagable::value is true; otherwise, | |
349 //! <code>false</code>. | |
350 static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW | |
351 { | |
352 container_detail::bool_<is_partially_propagable::value> flag; | |
353 return allocator_traits::priv_storage_is_unpropagable(flag, a, p); | |
354 } | |
355 | |
356 //! <b>Returns</b>: <code>true</code> if <code>is_always_equal::value == true</code>, otherwise, | |
357 //! <code>a == b</code>. | |
358 static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW | |
359 { | |
360 container_detail::bool_<is_always_equal::value> flag; | |
361 return allocator_traits::priv_equal(flag, a, b); | |
362 } | |
363 | |
289 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | 364 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) |
365 private: | |
366 static pointer priv_allocate(container_detail::true_type, Allocator &a, size_type n, const_void_pointer p) | |
367 { return a.allocate(n, p); } | |
368 | |
369 static pointer priv_allocate(container_detail::false_type, Allocator &a, size_type n, const_void_pointer) | |
370 { return a.allocate(n); } | |
371 | |
372 template<class T> | |
373 static void priv_destroy(container_detail::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW | |
374 { a.destroy(p); } | |
375 | |
376 template<class T> | |
377 static void priv_destroy(container_detail::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW | |
378 { p->~T(); (void)p; } | |
379 | |
380 static size_type priv_max_size(container_detail::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW | |
381 { return a.max_size(); } | |
382 | |
383 static size_type priv_max_size(container_detail::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW | |
384 { return size_type(-1)/sizeof(value_type); } | |
385 | |
386 static Allocator priv_select_on_container_copy_construction(container_detail::true_type, const Allocator &a) | |
387 { return a.select_on_container_copy_construction(); } | |
388 | |
389 static const Allocator &priv_select_on_container_copy_construction(container_detail::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW | |
390 { return a; } | |
391 | |
392 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
393 template<class T, class ...Args> | |
394 static void priv_construct(container_detail::false_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) | |
395 { | |
396 const bool value = boost::container::container_detail:: | |
397 has_member_function_callable_with_construct | |
398 < Allocator, T*, Args... >::value; | |
399 container_detail::bool_<value> flag; | |
400 (priv_construct_dispatch_next)(flag, a, p, ::boost::forward<Args>(args)...); | |
401 } | |
402 | |
403 template<class T, class ...Args> | |
404 static void priv_construct(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) | |
405 { (priv_construct_dispatch_next)(container_detail::false_type(), a, p, ::boost::forward<Args>(args)...); } | |
406 | |
407 template<class T, class ...Args> | |
408 static void priv_construct_dispatch_next(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) | |
409 { a.construct( p, ::boost::forward<Args>(args)...); } | |
410 | |
411 template<class T, class ...Args> | |
412 static void priv_construct_dispatch_next(container_detail::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) | |
413 { ::new((void*)p, boost_container_new_t()) T(::boost::forward<Args>(args)...); } | |
414 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
415 public: | |
416 | |
417 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \ | |
418 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ | |
419 static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ | |
420 {\ | |
421 container_detail::bool_<container_detail::is_std_allocator<Allocator>::value> flag;\ | |
422 (priv_construct)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ | |
423 }\ | |
424 // | |
425 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL) | |
426 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL | |
427 | |
290 private: | 428 private: |
291 static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p) | 429 |
292 { return a.allocate(n, p); } | 430 ////////////////// |
293 | 431 // priv_construct |
294 static pointer priv_allocate(boost::false_type, Alloc &a, size_type n, const_void_pointer) | 432 ////////////////// |
295 { return allocator_traits::allocate(a, n); } | 433 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \ |
296 | 434 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ |
297 template<class T> | 435 static void priv_construct(container_detail::false_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ |
298 static void priv_destroy(boost::true_type, Alloc &a, T* p) | 436 {\ |
299 { a.destroy(p); } | 437 const bool value = boost::container::container_detail::has_member_function_callable_with_construct\ |
300 | 438 < Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N>::value;\ |
301 template<class T> | 439 container_detail::bool_<value> flag;\ |
302 static void priv_destroy(boost::false_type, Alloc &, T* p) | 440 (priv_construct_dispatch_next)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ |
303 { p->~T(); (void)p; } | 441 }\ |
304 | 442 \ |
305 static size_type priv_max_size(boost::true_type, const Alloc &a) | 443 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ |
306 { return a.max_size(); } | 444 static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ |
307 | 445 { (priv_construct_dispatch_next)(container_detail::false_type(), a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ |
308 static size_type priv_max_size(boost::false_type, const Alloc &) | 446 // |
309 { return (std::numeric_limits<size_type>::max)(); } | 447 BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL) |
310 | 448 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL |
311 static Alloc priv_select_on_container_copy_construction(boost::true_type, const Alloc &a) | 449 |
312 { return a.select_on_container_copy_construction(); } | 450 ///////////////////////////////// |
313 | 451 // priv_construct_dispatch_next |
314 static const Alloc &priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) | 452 ///////////////////////////////// |
315 { return a; } | 453 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_DISPATCH_NEXT_IMPL(N) \ |
316 | 454 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ |
317 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | 455 static void priv_construct_dispatch_next(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ |
318 template<class T, class ...Args> | 456 { a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\ |
319 static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) | 457 \ |
320 { | 458 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ |
321 const bool value = boost::container::container_detail:: | 459 static void priv_construct_dispatch_next(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ |
322 has_member_function_callable_with_construct | 460 { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\ |
323 < Alloc, T*, Args... >::value; | 461 // |
324 ::boost::integral_constant<bool, value> flag; | 462 BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_DISPATCH_NEXT_IMPL) |
325 priv_construct_dispatch2(flag, a, p, ::boost::forward<Args>(args)...); | 463 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_DISPATCH_NEXT_IMPL |
326 } | 464 |
327 | 465 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) |
328 template<class T, class ...Args> | 466 |
329 static void priv_construct(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) | 467 template<class T> |
330 { | 468 static void priv_construct_dispatch_next(container_detail::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) |
331 priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward<Args>(args)...); | 469 { ::new((void*)p) T; } |
332 } | 470 |
333 | 471 static bool priv_storage_is_unpropagable(container_detail::true_type, const Allocator &a, pointer p) |
334 template<class T, class ...Args> | 472 { return a.storage_is_unpropagable(p); } |
335 static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) | 473 |
336 { a.construct( p, ::boost::forward<Args>(args)...); } | 474 static bool priv_storage_is_unpropagable(container_detail::false_type, const Allocator &, pointer) |
337 | 475 { return false; } |
338 template<class T, class ...Args> | 476 |
339 static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, BOOST_FWD_REF(Args) ...args) | 477 static bool priv_equal(container_detail::true_type, const Allocator &, const Allocator &) |
340 { ::new((void*)p) T(::boost::forward<Args>(args)...); } | 478 { return true; } |
341 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | 479 |
342 public: | 480 static bool priv_equal(container_detail::false_type, const Allocator &a, const Allocator &b) |
343 #define BOOST_PP_LOCAL_MACRO(n) \ | 481 { return a == b; } |
344 template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ | 482 |
345 static void construct(Alloc &a, T *p \ | |
346 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ | |
347 { \ | |
348 ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; \ | |
349 allocator_traits::priv_construct(flag, a, p \ | |
350 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ | |
351 } \ | |
352 // | |
353 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) | |
354 #include BOOST_PP_LOCAL_ITERATE() | |
355 | |
356 private: | |
357 #define BOOST_PP_LOCAL_MACRO(n) \ | |
358 template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ | |
359 static void priv_construct(boost::false_type, Alloc &a, T *p \ | |
360 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ | |
361 { \ | |
362 const bool value = \ | |
363 boost::container::container_detail::has_member_function_callable_with_construct \ | |
364 < Alloc, T* BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_FWD_TYPE, _) >::value; \ | |
365 ::boost::integral_constant<bool, value> flag; \ | |
366 priv_construct_dispatch2(flag, a, p \ | |
367 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ | |
368 } \ | |
369 \ | |
370 template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ | |
371 static void priv_construct(boost::true_type, Alloc &a, T *p \ | |
372 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ | |
373 { \ | |
374 priv_construct_dispatch2(boost::false_type(), a, p \ | |
375 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ | |
376 } \ | |
377 \ | |
378 template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ | |
379 static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p \ | |
380 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ | |
381 { a.construct( p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); } \ | |
382 \ | |
383 template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ | |
384 static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p \ | |
385 BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \ | |
386 { ::new((void*)p) T(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ | |
387 // | |
388 #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) | |
389 #include BOOST_PP_LOCAL_ITERATE() | |
390 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) | |
391 | |
392 template<class T> | |
393 static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, ::boost::container::default_init_t) | |
394 { ::new((void*)p) T; } | |
395 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) | 483 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) |
396 | |
397 ///@endcond | |
398 }; | 484 }; |
399 | 485 |
400 } //namespace container { | 486 } //namespace container { |
401 } //namespace boost { | 487 } //namespace boost { |
402 | 488 |