1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Pablo Halpern 2009. Distributed under the Boost
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)
7 //////////////////////////////////////////////////////////////////////////////
9 // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
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)
13 // See http://www.boost.org/libs/container for documentation.
15 //////////////////////////////////////////////////////////////////////////////
16 #ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP
17 #define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP
19 #ifndef BOOST_CONFIG_HPP
20 # include <boost/config.hpp>
23 #if defined(BOOST_HAS_PRAGMA_ONCE)
27 #include <boost/container/detail/config_begin.hpp>
28 #include <boost/container/detail/workaround.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>
39 #include <boost/intrusive/pointer_traits.hpp>
40 #include <boost/intrusive/detail/mpl.hpp>
42 #include <boost/move/utility_core.hpp>
44 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
45 #include <boost/move/detail/fwd_macros.hpp>
48 #include <boost/static_assert.hpp>
50 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
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>
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>
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>
73 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
78 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
80 template<class Allocator>
81 class small_vector_allocator;
83 namespace allocator_traits_detail {
85 BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_max_size, max_size)
86 BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_select_on_container_copy_construction, select_on_container_copy_construction)
88 } //namespace allocator_traits_detail {
90 namespace container_detail {
92 //workaround needed for C++03 compilers with no construct()
93 //supporting rvalue references
94 template<class Allocator>
95 struct is_std_allocator
96 { static const bool value = false; };
99 struct is_std_allocator< std::allocator<T> >
100 { static const bool value = true; };
103 struct is_std_allocator< small_vector_allocator< std::allocator<T> > >
104 { static const bool value = true; };
106 template<class Allocator>
107 struct is_not_std_allocator
108 { static const bool value = !is_std_allocator<Allocator>::value; };
110 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer)
111 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_pointer)
112 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference)
113 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference)
114 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(void_pointer)
115 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_void_pointer)
116 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type)
117 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment)
118 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment)
119 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap)
120 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_always_equal)
121 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type)
122 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_partially_propagable)
124 } //namespace container_detail {
126 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
128 //! The class template allocator_traits supplies a uniform interface to all allocator types.
129 //! This class is a C++03-compatible implementation of std::allocator_traits
130 template <typename Allocator>
131 struct allocator_traits
134 typedef Allocator allocator_type;
136 typedef typename allocator_type::value_type value_type;
138 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
139 //! Allocator::pointer if such a type exists; otherwise, value_type*
141 typedef unspecified pointer;
142 //! Allocator::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const
144 typedef see_documentation const_pointer;
145 //! Non-standard extension
146 //! Allocator::reference if such a type exists; otherwise, value_type&
147 typedef see_documentation reference;
148 //! Non-standard extension
149 //! Allocator::const_reference if such a type exists ; otherwise, const value_type&
150 typedef see_documentation const_reference;
151 //! Allocator::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>.
153 typedef see_documentation void_pointer;
154 //! Allocator::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const
156 typedef see_documentation const_void_pointer;
157 //! Allocator::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type.
159 typedef see_documentation difference_type;
160 //! Allocator::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type
162 typedef see_documentation size_type;
163 //! Allocator::propagate_on_container_copy_assignment if such a type exists, otherwise a type
164 //! with an internal constant static boolean member <code>value</code> == false.
165 typedef see_documentation propagate_on_container_copy_assignment;
166 //! Allocator::propagate_on_container_move_assignment if such a type exists, otherwise a type
167 //! with an internal constant static boolean member <code>value</code> == false.
168 typedef see_documentation propagate_on_container_move_assignment;
169 //! Allocator::propagate_on_container_swap if such a type exists, otherwise a type
170 //! with an internal constant static boolean member <code>value</code> == false.
171 typedef see_documentation propagate_on_container_swap;
172 //! Allocator::is_always_equal if such a type exists, otherwise a type
173 //! with an internal constant static boolean member <code>value</code> == is_empty<Allocator>::value
174 typedef see_documentation is_always_equal;
175 //! Allocator::is_partially_propagable if such a type exists, otherwise a type
176 //! with an internal constant static boolean member <code>value</code> == false
177 //! <b>Note</b>: Non-standard extension used to implement `small_vector_allocator`.
178 typedef see_documentation is_partially_propagable;
179 //! Defines an allocator: Allocator::rebind<T>::other if such a type exists; otherwise, Allocator<T, Args>
180 //! if Allocator is a class template instantiation of the form Allocator<U, Args>, where Args is zero or
181 //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed.
183 //! In C++03 compilers <code>rebind_alloc</code> is a struct derived from an allocator
184 //! deduced by previously detailed rules.
185 template <class T> using rebind_alloc = see_documentation;
187 //! In C++03 compilers <code>rebind_traits</code> is a struct derived from
188 //! <code>allocator_traits<OtherAlloc></code>, where <code>OtherAlloc</code> is
189 //! the allocator deduced by rules explained in <code>rebind_alloc</code>.
190 template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >;
192 //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
193 //! <code>type</code> is an allocator related to Allocator deduced deduced by rules explained in <code>rebind_alloc</code>.
195 struct portable_rebind_alloc
196 { typedef see_documentation type; };
199 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
200 pointer, value_type*)
203 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator,
204 const_pointer, typename boost::intrusive::pointer_traits<pointer>::template
205 rebind_pointer<const value_type>)
208 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
209 reference, typename container_detail::unvoid_ref<value_type>::type)
212 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
213 const_reference, typename container_detail::unvoid_ref<const value_type>::type)
216 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator,
217 void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
218 rebind_pointer<void>)
221 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator,
222 const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
223 rebind_pointer<const void>)
226 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
227 difference_type, std::ptrdiff_t)
230 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
231 size_type, std::size_t)
233 //propagate_on_container_copy_assignment
234 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
235 propagate_on_container_copy_assignment, container_detail::false_type)
236 propagate_on_container_copy_assignment;
237 //propagate_on_container_move_assignment
238 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
239 propagate_on_container_move_assignment, container_detail::false_type)
240 propagate_on_container_move_assignment;
241 //propagate_on_container_swap
242 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
243 propagate_on_container_swap, container_detail::false_type)
244 propagate_on_container_swap;
246 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
247 is_always_equal, container_detail::is_empty<Allocator>)
249 //is_partially_propagable
250 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator,
251 is_partially_propagable, container_detail::false_type)
252 is_partially_propagable;
254 //rebind_alloc & rebind_traits
255 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
257 template <typename T> using rebind_alloc = typename boost::intrusive::pointer_rebind<Allocator, T>::type;
258 template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >;
259 #else // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
260 //Some workaround for C++03 or C++11 compilers with no template aliases
261 template <typename T>
262 struct rebind_alloc : boost::intrusive::pointer_rebind<Allocator,T>::type
264 typedef typename boost::intrusive::pointer_rebind<Allocator,T>::type Base;
265 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
266 template <typename... Args>
267 rebind_alloc(BOOST_FWD_REF(Args)... args) : Base(boost::forward<Args>(args)...) {}
268 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
269 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC(N) \
270 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\
271 explicit rebind_alloc(BOOST_MOVE_UREF##N) : Base(BOOST_MOVE_FWD##N){}\
273 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC)
274 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC
275 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
278 template <typename T>
280 : allocator_traits<typename boost::intrusive::pointer_rebind<Allocator, T>::type>
282 #endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
284 //portable_rebind_alloc
286 struct portable_rebind_alloc
287 { typedef typename boost::intrusive::pointer_rebind<Allocator, T>::type type; };
288 #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
290 //! <b>Returns</b>: <code>a.allocate(n)</code>
292 BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n)
293 { return a.allocate(n); }
295 //! <b>Returns</b>: <code>a.deallocate(p, n)</code>
297 //! <b>Throws</b>: Nothing
298 BOOST_CONTAINER_FORCEINLINE static void deallocate(Allocator &a, pointer p, size_type n)
299 { a.deallocate(p, n); }
301 //! <b>Effects</b>: calls <code>a.allocate(n, p)</code> if that call is well-formed;
302 //! otherwise, invokes <code>a.allocate(n)</code>
303 BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n, const_void_pointer p)
305 const bool value = boost::container::container_detail::
306 has_member_function_callable_with_allocate
307 <Allocator, const size_type, const const_void_pointer>::value;
308 container_detail::bool_<value> flag;
309 return allocator_traits::priv_allocate(flag, a, n, p);
312 //! <b>Effects</b>: calls <code>a.destroy(p)</code> if that call is well-formed;
313 //! otherwise, invokes <code>p->~T()</code>.
315 BOOST_CONTAINER_FORCEINLINE static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW
317 typedef T* destroy_pointer;
318 const bool value = boost::container::container_detail::
319 has_member_function_callable_with_destroy
320 <Allocator, const destroy_pointer>::value;
321 container_detail::bool_<value> flag;
322 allocator_traits::priv_destroy(flag, a, p);
325 //! <b>Returns</b>: <code>a.max_size()</code> if that expression is well-formed; otherwise,
326 //! <code>numeric_limits<size_type>::max()</code>.
327 BOOST_CONTAINER_FORCEINLINE static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW
329 const bool value = allocator_traits_detail::has_max_size<Allocator, size_type (Allocator::*)() const>::value;
330 container_detail::bool_<value> flag;
331 return allocator_traits::priv_max_size(flag, a);
334 //! <b>Returns</b>: <code>a.select_on_container_copy_construction()</code> if that expression is well-formed;
336 BOOST_CONTAINER_FORCEINLINE static BOOST_CONTAINER_DOC1ST(Allocator,
337 typename container_detail::if_c
338 < allocator_traits_detail::has_select_on_container_copy_construction<Allocator BOOST_MOVE_I Allocator (Allocator::*)() const>::value
339 BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type)
340 select_on_container_copy_construction(const Allocator &a)
342 const bool value = allocator_traits_detail::has_select_on_container_copy_construction
343 <Allocator, Allocator (Allocator::*)() const>::value;
344 container_detail::bool_<value> flag;
345 return allocator_traits::priv_select_on_container_copy_construction(flag, a);
348 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
349 //! <b>Effects</b>: calls <code>a.construct(p, std::forward<Args>(args)...)</code> if that call is well-formed;
350 //! otherwise, invokes <code>`placement new` (static_cast<void*>(p)) T(std::forward<Args>(args)...)</code>
351 template <class T, class ...Args>
352 BOOST_CONTAINER_FORCEINLINE static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args)
354 static const bool value = ::boost::move_detail::and_
355 < container_detail::is_not_std_allocator<Allocator>
356 , boost::container::container_detail::has_member_function_callable_with_construct
357 < Allocator, T*, Args... >
359 container_detail::bool_<value> flag;
360 allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...);
364 //! <b>Returns</b>: <code>a.storage_is_unpropagable(p)</code> if is_partially_propagable::value is true; otherwise,
365 //! <code>false</code>.
366 BOOST_CONTAINER_FORCEINLINE static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW
368 container_detail::bool_<is_partially_propagable::value> flag;
369 return allocator_traits::priv_storage_is_unpropagable(flag, a, p);
372 //! <b>Returns</b>: <code>true</code> if <code>is_always_equal::value == true</code>, otherwise,
373 //! <code>a == b</code>.
374 BOOST_CONTAINER_FORCEINLINE static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW
376 container_detail::bool_<is_always_equal::value> flag;
377 return allocator_traits::priv_equal(flag, a, b);
380 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
382 BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::true_type, Allocator &a, size_type n, const_void_pointer p)
383 { return a.allocate(n, p); }
385 BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::false_type, Allocator &a, size_type n, const_void_pointer)
386 { return a.allocate(n); }
389 BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW
393 BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW
394 { p->~T(); (void)p; }
396 BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(container_detail::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW
397 { return a.max_size(); }
399 BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(container_detail::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW
400 { return size_type(-1)/sizeof(value_type); }
402 BOOST_CONTAINER_FORCEINLINE static Allocator priv_select_on_container_copy_construction(container_detail::true_type, const Allocator &a)
403 { return a.select_on_container_copy_construction(); }
405 BOOST_CONTAINER_FORCEINLINE static const Allocator &priv_select_on_container_copy_construction(container_detail::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW
408 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
409 template<class T, class ...Args>
410 BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args)
411 { a.construct( p, ::boost::forward<Args>(args)...); }
413 template<class T, class ...Args>
414 BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args)
415 { ::new((void*)p, boost_container_new_t()) T(::boost::forward<Args>(args)...); }
416 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
419 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \
420 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
421 BOOST_CONTAINER_FORCEINLINE static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
423 static const bool value = ::boost::move_detail::and_ \
424 < container_detail::is_not_std_allocator<Allocator> \
425 , boost::container::container_detail::has_member_function_callable_with_construct \
426 < Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N > \
428 container_detail::bool_<value> flag;\
429 (priv_construct)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
432 BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL)
433 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL
436 /////////////////////////////////
438 /////////////////////////////////
439 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \
440 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
441 BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
442 { a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\
444 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
445 BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
446 { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\
448 BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL)
449 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL
451 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
454 BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, const ::boost::container::default_init_t&)
455 { ::new((void*)p, boost_container_new_t()) T; }
457 BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::true_type, const Allocator &a, pointer p)
458 { return a.storage_is_unpropagable(p); }
460 BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::false_type, const Allocator &, pointer)
463 BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::true_type, const Allocator &, const Allocator &)
466 BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::false_type, const Allocator &a, const Allocator &b)
469 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
472 } //namespace container {
473 } //namespace boost {
475 #include <boost/container/detail/config_end.hpp>
477 #endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP)