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 #if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
53 #pragma GCC diagnostic push
54 #pragma GCC diagnostic ignored "-Wunused-result"
57 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate
58 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl {
59 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
60 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 2
61 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 2
62 #include <boost/intrusive/detail/has_member_function_callable_with.hpp>
64 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy
65 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl {
66 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
67 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1
68 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1
69 #include <boost/intrusive/detail/has_member_function_callable_with.hpp>
71 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct
72 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl {
73 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
74 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1
75 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 9
76 #include <boost/intrusive/detail/has_member_function_callable_with.hpp>
78 #if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
79 #pragma GCC diagnostic pop
82 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
87 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
89 template<class T, class VoidAllocator, class Options>
90 class small_vector_allocator;
92 namespace allocator_traits_detail {
94 BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_max_size, max_size)
95 BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_select_on_container_copy_construction, select_on_container_copy_construction)
97 } //namespace allocator_traits_detail {
101 //workaround needed for C++03 compilers with no construct()
102 //supporting rvalue references
103 template<class Allocator>
104 struct is_std_allocator
105 { static const bool value = false; };
108 struct is_std_allocator< std::allocator<T> >
109 { static const bool value = true; };
111 template<class T, class Options>
112 struct is_std_allocator< small_vector_allocator<T, std::allocator<T>, Options > >
113 { static const bool value = true; };
115 template<class Allocator>
116 struct is_not_std_allocator
117 { static const bool value = !is_std_allocator<Allocator>::value; };
119 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer)
120 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_pointer)
121 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference)
122 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference)
123 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(void_pointer)
124 BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_void_pointer)
125 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type)
126 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment)
127 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment)
128 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap)
129 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_always_equal)
130 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type)
131 BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_partially_propagable)
135 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
137 //! The class template allocator_traits supplies a uniform interface to all allocator types.
138 //! This class is a C++03-compatible implementation of std::allocator_traits
139 template <typename Allocator>
140 struct allocator_traits
143 typedef Allocator allocator_type;
145 typedef typename allocator_type::value_type value_type;
147 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
148 //! Allocator::pointer if such a type exists; otherwise, value_type*
150 typedef unspecified pointer;
151 //! Allocator::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const
153 typedef see_documentation const_pointer;
154 //! Non-standard extension
155 //! Allocator::reference if such a type exists; otherwise, value_type&
156 typedef see_documentation reference;
157 //! Non-standard extension
158 //! Allocator::const_reference if such a type exists ; otherwise, const value_type&
159 typedef see_documentation const_reference;
160 //! Allocator::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>.
162 typedef see_documentation void_pointer;
163 //! Allocator::const_void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const
165 typedef see_documentation const_void_pointer;
166 //! Allocator::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type.
168 typedef see_documentation difference_type;
169 //! Allocator::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type
171 typedef see_documentation size_type;
172 //! Allocator::propagate_on_container_copy_assignment if such a type exists, otherwise a type
173 //! with an internal constant static boolean member <code>value</code> == false.
174 typedef see_documentation propagate_on_container_copy_assignment;
175 //! Allocator::propagate_on_container_move_assignment if such a type exists, otherwise a type
176 //! with an internal constant static boolean member <code>value</code> == false.
177 typedef see_documentation propagate_on_container_move_assignment;
178 //! Allocator::propagate_on_container_swap if such a type exists, otherwise a type
179 //! with an internal constant static boolean member <code>value</code> == false.
180 typedef see_documentation propagate_on_container_swap;
181 //! Allocator::is_always_equal if such a type exists, otherwise a type
182 //! with an internal constant static boolean member <code>value</code> == is_empty<Allocator>::value
183 typedef see_documentation is_always_equal;
184 //! Allocator::is_partially_propagable if such a type exists, otherwise a type
185 //! with an internal constant static boolean member <code>value</code> == false
186 //! <b>Note</b>: Non-standard extension used to implement `small_vector_allocator`.
187 typedef see_documentation is_partially_propagable;
188 //! Defines an allocator: Allocator::rebind<T>::other if such a type exists; otherwise, Allocator<T, Args>
189 //! if Allocator is a class template instantiation of the form Allocator<U, Args>, where Args is zero or
190 //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed.
192 //! In C++03 compilers <code>rebind_alloc</code> is a struct derived from an allocator
193 //! deduced by previously detailed rules.
194 template <class T> using rebind_alloc = see_documentation;
196 //! In C++03 compilers <code>rebind_traits</code> is a struct derived from
197 //! <code>allocator_traits<OtherAlloc></code>, where <code>OtherAlloc</code> is
198 //! the allocator deduced by rules explained in <code>rebind_alloc</code>.
199 template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >;
201 //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
202 //! <code>type</code> is an allocator related to Allocator deduced deduced by rules explained in <code>rebind_alloc</code>.
204 struct portable_rebind_alloc
205 { typedef see_documentation type; };
208 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
209 pointer, value_type*)
212 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator,
213 const_pointer, typename boost::intrusive::pointer_traits<pointer>::template
214 rebind_pointer<const value_type>)
217 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
218 reference, typename dtl::unvoid_ref<value_type>::type)
221 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
222 const_reference, typename dtl::unvoid_ref<const value_type>::type)
225 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator,
226 void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
227 rebind_pointer<void>)
230 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator,
231 const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
232 rebind_pointer<const void>)
235 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
236 difference_type, std::ptrdiff_t)
239 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
240 size_type, std::size_t)
242 //propagate_on_container_copy_assignment
243 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
244 propagate_on_container_copy_assignment, dtl::false_type)
245 propagate_on_container_copy_assignment;
246 //propagate_on_container_move_assignment
247 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
248 propagate_on_container_move_assignment, dtl::false_type)
249 propagate_on_container_move_assignment;
250 //propagate_on_container_swap
251 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
252 propagate_on_container_swap, dtl::false_type)
253 propagate_on_container_swap;
255 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
256 is_always_equal, dtl::is_empty<Allocator>)
258 //is_partially_propagable
259 typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator,
260 is_partially_propagable, dtl::false_type)
261 is_partially_propagable;
263 //rebind_alloc & rebind_traits
264 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
266 template <typename T> using rebind_alloc = typename boost::intrusive::pointer_rebind<Allocator, T>::type;
267 template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >;
268 #else // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
269 //Some workaround for C++03 or C++11 compilers with no template aliases
270 template <typename T>
271 struct rebind_alloc : boost::intrusive::pointer_rebind<Allocator,T>::type
273 typedef typename boost::intrusive::pointer_rebind<Allocator,T>::type Base;
274 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
275 template <typename... Args>
276 rebind_alloc(BOOST_FWD_REF(Args)... args) : Base(boost::forward<Args>(args)...) {}
277 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
278 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC(N) \
279 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\
280 explicit rebind_alloc(BOOST_MOVE_UREF##N) : Base(BOOST_MOVE_FWD##N){}\
282 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC)
283 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC
284 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
287 template <typename T>
289 : allocator_traits<typename boost::intrusive::pointer_rebind<Allocator, T>::type>
291 #endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
293 //portable_rebind_alloc
295 struct portable_rebind_alloc
296 { typedef typename boost::intrusive::pointer_rebind<Allocator, T>::type type; };
297 #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
299 //! <b>Returns</b>: <code>a.allocate(n)</code>
301 BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n)
302 { return a.allocate(n); }
304 //! <b>Returns</b>: <code>a.deallocate(p, n)</code>
306 //! <b>Throws</b>: Nothing
307 BOOST_CONTAINER_FORCEINLINE static void deallocate(Allocator &a, pointer p, size_type n)
308 { a.deallocate(p, n); }
310 //! <b>Effects</b>: calls <code>a.allocate(n, p)</code> if that call is well-formed;
311 //! otherwise, invokes <code>a.allocate(n)</code>
312 BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n, const_void_pointer p)
314 const bool value = boost::container::dtl::
315 has_member_function_callable_with_allocate
316 <Allocator, const size_type, const const_void_pointer>::value;
317 dtl::bool_<value> flag;
318 return allocator_traits::priv_allocate(flag, a, n, p);
321 //! <b>Effects</b>: calls <code>a.destroy(p)</code> if that call is well-formed;
322 //! otherwise, invokes <code>p->~T()</code>.
324 BOOST_CONTAINER_FORCEINLINE static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW
326 typedef T* destroy_pointer;
327 const bool value = boost::container::dtl::
328 has_member_function_callable_with_destroy
329 <Allocator, const destroy_pointer>::value;
330 dtl::bool_<value> flag;
331 allocator_traits::priv_destroy(flag, a, p);
334 //! <b>Returns</b>: <code>a.max_size()</code> if that expression is well-formed; otherwise,
335 //! <code>numeric_limits<size_type>::max()</code>.
336 BOOST_CONTAINER_FORCEINLINE static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW
338 const bool value = allocator_traits_detail::has_max_size<Allocator, size_type (Allocator::*)() const>::value;
339 dtl::bool_<value> flag;
340 return allocator_traits::priv_max_size(flag, a);
343 //! <b>Returns</b>: <code>a.select_on_container_copy_construction()</code> if that expression is well-formed;
345 BOOST_CONTAINER_FORCEINLINE static BOOST_CONTAINER_DOC1ST(Allocator,
347 < allocator_traits_detail::has_select_on_container_copy_construction<Allocator BOOST_MOVE_I Allocator (Allocator::*)() const>::value
348 BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type)
349 select_on_container_copy_construction(const Allocator &a)
351 const bool value = allocator_traits_detail::has_select_on_container_copy_construction
352 <Allocator, Allocator (Allocator::*)() const>::value;
353 dtl::bool_<value> flag;
354 return allocator_traits::priv_select_on_container_copy_construction(flag, a);
357 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
358 //! <b>Effects</b>: calls <code>a.construct(p, std::forward<Args>(args)...)</code> if that call is well-formed;
359 //! otherwise, invokes <code>`placement new` (static_cast<void*>(p)) T(std::forward<Args>(args)...)</code>
360 template <class T, class ...Args>
361 BOOST_CONTAINER_FORCEINLINE static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args)
363 static const bool value = ::boost::move_detail::and_
364 < dtl::is_not_std_allocator<Allocator>
365 , boost::container::dtl::has_member_function_callable_with_construct
366 < Allocator, T*, Args... >
368 dtl::bool_<value> flag;
369 allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...);
373 //! <b>Returns</b>: <code>a.storage_is_unpropagable(p)</code> if is_partially_propagable::value is true; otherwise,
374 //! <code>false</code>.
375 BOOST_CONTAINER_FORCEINLINE static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW
377 dtl::bool_<is_partially_propagable::value> flag;
378 return allocator_traits::priv_storage_is_unpropagable(flag, a, p);
381 //! <b>Returns</b>: <code>true</code> if <code>is_always_equal::value == true</code>, otherwise,
382 //! <code>a == b</code>.
383 BOOST_CONTAINER_FORCEINLINE static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW
385 dtl::bool_<is_always_equal::value> flag;
386 return allocator_traits::priv_equal(flag, a, b);
389 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
391 BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::true_type, Allocator &a, size_type n, const_void_pointer p)
392 { return a.allocate(n, p); }
394 BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::false_type, Allocator &a, size_type n, const_void_pointer)
395 { return a.allocate(n); }
398 BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW
402 BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW
403 { p->~T(); (void)p; }
405 BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(dtl::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW
406 { return a.max_size(); }
408 BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(dtl::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW
409 { return size_type(-1)/sizeof(value_type); }
411 BOOST_CONTAINER_FORCEINLINE static Allocator priv_select_on_container_copy_construction(dtl::true_type, const Allocator &a)
412 { return a.select_on_container_copy_construction(); }
414 BOOST_CONTAINER_FORCEINLINE static const Allocator &priv_select_on_container_copy_construction(dtl::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW
417 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
418 template<class T, class ...Args>
419 BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args)
420 { a.construct( p, ::boost::forward<Args>(args)...); }
422 template<class T, class ...Args>
423 BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args)
424 { ::new((void*)p, boost_container_new_t()) T(::boost::forward<Args>(args)...); }
425 #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
428 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \
429 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
430 BOOST_CONTAINER_FORCEINLINE static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
432 static const bool value = ::boost::move_detail::and_ \
433 < dtl::is_not_std_allocator<Allocator> \
434 , boost::container::dtl::has_member_function_callable_with_construct \
435 < Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N > \
437 dtl::bool_<value> flag;\
438 (priv_construct)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
441 BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL)
442 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL
445 /////////////////////////////////
447 /////////////////////////////////
448 #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \
449 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
450 BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
451 { a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\
453 template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
454 BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
455 { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\
457 BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL)
458 #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL
460 #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
463 BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, const ::boost::container::default_init_t&)
464 { ::new((void*)p, boost_container_new_t()) T; }
466 BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::true_type, const Allocator &a, pointer p)
467 { return a.storage_is_unpropagable(p); }
469 BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::false_type, const Allocator &, pointer)
472 BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::true_type, const Allocator &, const Allocator &)
475 BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::false_type, const Allocator &a, const Allocator &b)
478 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
481 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
483 template<class T, class AllocatorOrVoid>
484 struct real_allocator
486 typedef AllocatorOrVoid type;
490 struct real_allocator<T, void>
492 typedef new_allocator<T> type;
495 #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
497 } //namespace container {
498 } //namespace boost {
500 #include <boost/container/detail/config_end.hpp>
502 #endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP)