diff options
Diffstat (limited to 'boost/container/detail')
39 files changed, 739 insertions, 646 deletions
diff --git a/boost/container/detail/adaptive_node_pool.hpp b/boost/container/detail/adaptive_node_pool.hpp index 20696100f5..33bfcc98a7 100644 --- a/boost/container/detail/adaptive_node_pool.hpp +++ b/boost/container/detail/adaptive_node_pool.hpp @@ -37,12 +37,12 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<bool AlignOnly> struct select_private_adaptive_node_pool_impl { - typedef boost::container::container_detail:: + typedef boost::container::dtl:: private_adaptive_node_pool_impl < fake_segment_manager , unsigned(AlignOnly)*::boost::container::adaptive_pool_flag::align_only @@ -157,7 +157,7 @@ class shared_adaptive_node_pool default_mutex mutex_; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/adaptive_node_pool_impl.hpp b/boost/container/detail/adaptive_node_pool_impl.hpp index 54db19dff2..9ff4ec5371 100644 --- a/boost/container/detail/adaptive_node_pool_impl.hpp +++ b/boost/container/detail/adaptive_node_pool_impl.hpp @@ -55,7 +55,7 @@ static const unsigned int address_ordered = 1u << 2u; } //namespace adaptive_pool_flag{ -namespace container_detail { +namespace dtl { template<class size_type> struct hdr_offset_holder_t @@ -876,7 +876,7 @@ class private_adaptive_node_pool_impl size_type m_totally_free_blocks; //Free blocks }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/addressof.hpp b/boost/container/detail/addressof.hpp index fedbdb91d1..b3b8a4dd6f 100644 --- a/boost/container/detail/addressof.hpp +++ b/boost/container/detail/addressof.hpp @@ -22,7 +22,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template <typename T> BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj) @@ -34,7 +34,7 @@ BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj) ))); } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/advanced_insert_int.hpp b/boost/container/detail/advanced_insert_int.hpp index db5e8df252..d9cba4858b 100644 --- a/boost/container/detail/advanced_insert_int.hpp +++ b/boost/container/detail/advanced_insert_int.hpp @@ -41,7 +41,7 @@ #include <boost/assert.hpp> #include <boost/core/no_exceptions_support.hpp> -namespace boost { namespace container { namespace container_detail { +namespace boost { namespace container { namespace dtl { template<class Allocator, class FwdIt, class Iterator> struct move_insert_range_proxy @@ -208,7 +208,7 @@ insert_copy_proxy<Allocator, It> get_insert_value_proxy(const typename boost::co return insert_copy_proxy<Allocator, It>(v); } -}}} //namespace boost { namespace container { namespace container_detail { +}}} //namespace boost { namespace container { namespace dtl { #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -217,7 +217,7 @@ insert_copy_proxy<Allocator, It> get_insert_value_proxy(const typename boost::co namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class Allocator, class Iterator, class ...Args> struct insert_nonmovable_emplace_proxy @@ -271,7 +271,7 @@ struct insert_emplace_proxy { BOOST_ASSERT(n ==1); (void)n; typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type *vp = static_cast<value_type *>(static_cast<void *>(&v)); + value_type *vp = static_cast<value_type *>(static_cast<void *>(v.data)); alloc_traits::construct(a, vp, ::boost::forward<Args>(get<IdxPack>(this->args_))...); BOOST_TRY{ @@ -301,7 +301,7 @@ struct insert_emplace_proxy<Allocator, Iterator, typename boost::container::allo //Any problem is solvable with an extra layer of indirection? ;-) template<class Allocator, class Iterator> struct insert_emplace_proxy<Allocator, Iterator - , typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type + , typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type > : public insert_copy_proxy<Allocator, Iterator> { @@ -321,7 +321,7 @@ struct insert_emplace_proxy<Allocator, Iterator, typename boost::container::allo template<class Allocator, class Iterator> struct insert_emplace_proxy<Allocator, Iterator - , typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type & + , typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type & > : public insert_copy_proxy<Allocator, Iterator> { @@ -330,7 +330,7 @@ struct insert_emplace_proxy<Allocator, Iterator {} }; -}}} //namespace boost { namespace container { namespace container_detail { +}}} //namespace boost { namespace container { namespace dtl { #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -338,7 +338,7 @@ struct insert_emplace_proxy<Allocator, Iterator namespace boost { namespace container { -namespace container_detail { +namespace dtl { #define BOOST_CONTAINER_ADVANCED_INSERT_INT_CODE(N) \ template< class Allocator, class Iterator BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ @@ -382,7 +382,7 @@ struct insert_emplace_proxy_arg##N\ BOOST_ASSERT(n == 1); (void)n;\ typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\ BOOST_ASSERT((((size_type)(&v)) % alignment_of<value_type>::value) == 0);\ - value_type *vp = static_cast<value_type *>(static_cast<void *>(&v));\ + value_type *vp = static_cast<value_type *>(static_cast<void *>(v.data));\ alloc_traits::construct(a, vp BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ BOOST_TRY{\ *p = ::boost::move(*vp);\ @@ -437,7 +437,7 @@ struct insert_emplace_proxy_arg1<Allocator, Iterator, typename boost::container: //Any problem is solvable with an extra layer of indirection? ;-) template<class Allocator, class Iterator> struct insert_emplace_proxy_arg1<Allocator, Iterator - , typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type + , typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type > : public insert_copy_proxy<Allocator, Iterator> { @@ -457,7 +457,7 @@ struct insert_emplace_proxy_arg1<Allocator, Iterator, typename boost::container: template<class Allocator, class Iterator> struct insert_emplace_proxy_arg1<Allocator, Iterator - , typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type & + , typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type & > : public insert_copy_proxy<Allocator, Iterator> { @@ -468,7 +468,7 @@ struct insert_emplace_proxy_arg1<Allocator, Iterator #endif -}}} //namespace boost { namespace container { namespace container_detail { +}}} //namespace boost { namespace container { namespace dtl { #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) diff --git a/boost/container/detail/alloc_helpers.hpp b/boost/container/detail/alloc_helpers.hpp index 656e0c2a5e..57c59e46c1 100644 --- a/boost/container/detail/alloc_helpers.hpp +++ b/boost/container/detail/alloc_helpers.hpp @@ -24,36 +24,36 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class AllocatorType> -inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) +inline void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template<class AllocatorType> -inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +inline void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { boost::adl_move_swap(l, r); } template<class AllocatorType> -inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type) +inline void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template<class AllocatorType> -inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type) +inline void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type) { l = r; } template<class AllocatorType> -inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) +inline void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template<class AllocatorType> -inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +inline void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { l = ::boost::move(r); } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/allocator_version_traits.hpp b/boost/container/detail/allocator_version_traits.hpp index 62492da091..18460bdf08 100644 --- a/boost/container/detail/allocator_version_traits.hpp +++ b/boost/container/detail/allocator_version_traits.hpp @@ -33,12 +33,12 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { -template<class Allocator, unsigned Version = boost::container::container_detail::version<Allocator>::value> +template<class Allocator, unsigned Version = boost::container::dtl::version<Allocator>::value> struct allocator_version_traits { - typedef ::boost::container::container_detail::integral_constant + typedef ::boost::container::dtl::integral_constant <unsigned, Version> alloc_version; typedef typename Allocator::multiallocation_chain multiallocation_chain; @@ -67,7 +67,7 @@ struct allocator_version_traits template<class Allocator> struct allocator_version_traits<Allocator, 1> { - typedef ::boost::container::container_detail::integral_constant + typedef ::boost::container::dtl::integral_constant <unsigned, 1> alloc_version; typedef typename boost::container::allocator_traits<Allocator>::pointer pointer; @@ -76,9 +76,9 @@ struct allocator_version_traits<Allocator, 1> typedef typename boost::intrusive::pointer_traits<pointer>:: template rebind_pointer<void>::type void_ptr; - typedef container_detail::basic_multiallocation_chain + typedef dtl::basic_multiallocation_chain <void_ptr> multialloc_cached_counted; - typedef boost::container::container_detail:: + typedef boost::container::dtl:: transform_multiallocation_chain < multialloc_cached_counted, value_type> multiallocation_chain; @@ -153,7 +153,7 @@ struct allocator_version_traits<Allocator, 1> } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/construct_in_place.hpp b/boost/container/detail/construct_in_place.hpp index 9fecd24a8f..b131f06a86 100644 --- a/boost/container/detail/construct_in_place.hpp +++ b/boost/container/detail/construct_in_place.hpp @@ -67,7 +67,7 @@ BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source) template<class DstIt, class U, class D> BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator<U, D>) { - container_detail::value_init<U> val; + dtl::value_init<U> val; *dest = boost::move(val.get()); } diff --git a/boost/container/detail/container_or_allocator_rebind.hpp b/boost/container/detail/container_or_allocator_rebind.hpp index c60d1c0c50..d74df6c966 100644 --- a/boost/container/detail/container_or_allocator_rebind.hpp +++ b/boost/container/detail/container_or_allocator_rebind.hpp @@ -24,7 +24,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class AllocatorOrContainer, class ToType, bool = is_container<AllocatorOrContainer>::value> struct container_or_allocator_rebind_impl @@ -42,7 +42,7 @@ struct container_or_allocator_rebind : container_or_allocator_rebind_impl<AllocatorOrContainer, ToType> {}; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/container_rebind.hpp b/boost/container/detail/container_rebind.hpp index 79ad9d7739..0ebb4789e4 100644 --- a/boost/container/detail/container_rebind.hpp +++ b/boost/container/detail/container_rebind.hpp @@ -23,7 +23,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template <class Cont, class U> struct container_rebind; @@ -251,7 +251,7 @@ namespace container_detail { #endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/copy_move_algo.hpp b/boost/container/detail/copy_move_algo.hpp index 5293260091..cc87e4abc0 100644 --- a/boost/container/detail/copy_move_algo.hpp +++ b/boost/container/detail/copy_move_algo.hpp @@ -38,7 +38,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class I> struct are_elements_contiguous @@ -65,17 +65,15 @@ struct are_elements_contiguous< ::boost::move_iterator<It> > : are_elements_contiguous<It> {}; +} //namespace dtl { + ///////////////////////// // predeclarations ///////////////////////// -template<class Pointer> -class vector_iterator; - -template<class Pointer> -class vector_const_iterator; +template <class Pointer, bool IsConst> +class vec_iterator; -} //namespace container_detail { } //namespace container { namespace interprocess { @@ -87,20 +85,14 @@ class offset_ptr; namespace container { -namespace container_detail { +namespace dtl { ///////////////////////// //vector_[const_]iterator ///////////////////////// -template<class Pointer> -struct are_elements_contiguous<boost::container::container_detail::vector_iterator<Pointer> > -{ - static const bool value = true; -}; - -template<class Pointer> -struct are_elements_contiguous<boost::container::container_detail::vector_const_iterator<Pointer> > +template <class Pointer, bool IsConst> +struct are_elements_contiguous<boost::container::vec_iterator<Pointer, IsConst> > { static const bool value = true; }; @@ -130,7 +122,7 @@ template <typename I, typename O> struct is_memtransfer_copy_assignable : boost::move_detail::and_ < are_contiguous_and_same<I, O> - , container_detail::is_trivially_copy_assignable< typename ::boost::container::iterator_traits<I>::value_type > + , dtl::is_trivially_copy_assignable< typename ::boost::container::iterator_traits<I>::value_type > > {}; @@ -138,28 +130,28 @@ template <typename I, typename O> struct is_memtransfer_copy_constructible : boost::move_detail::and_ < are_contiguous_and_same<I, O> - , container_detail::is_trivially_copy_constructible< typename ::boost::container::iterator_traits<I>::value_type > + , dtl::is_trivially_copy_constructible< typename ::boost::container::iterator_traits<I>::value_type > > {}; template <typename I, typename O, typename R> struct enable_if_memtransfer_copy_constructible - : enable_if<container_detail::is_memtransfer_copy_constructible<I, O>, R> + : enable_if<dtl::is_memtransfer_copy_constructible<I, O>, R> {}; template <typename I, typename O, typename R> struct disable_if_memtransfer_copy_constructible - : disable_if<container_detail::is_memtransfer_copy_constructible<I, O>, R> + : disable_if<dtl::is_memtransfer_copy_constructible<I, O>, R> {}; template <typename I, typename O, typename R> struct enable_if_memtransfer_copy_assignable - : enable_if<container_detail::is_memtransfer_copy_assignable<I, O>, R> + : enable_if<dtl::is_memtransfer_copy_assignable<I, O>, R> {}; template <typename I, typename O, typename R> struct disable_if_memtransfer_copy_assignable - : disable_if<container_detail::is_memtransfer_copy_assignable<I, O>, R> + : disable_if<dtl::is_memtransfer_copy_assignable<I, O>, R> {}; template @@ -224,44 +216,44 @@ struct is_memzero_initializable { typedef typename ::boost::container::iterator_traits<O>::value_type value_type; static const bool value = are_elements_contiguous<O>::value && - ( container_detail::is_integral<value_type>::value || container_detail::is_enum<value_type>::value + ( dtl::is_integral<value_type>::value || dtl::is_enum<value_type>::value #if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL) - || container_detail::is_pointer<value_type>::value + || dtl::is_pointer<value_type>::value #endif #if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO) - || container_detail::is_floating_point<value_type>::value + || dtl::is_floating_point<value_type>::value #endif #if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO) && defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL) - || container_detail::is_pod<value_type>::value + || dtl::is_pod<value_type>::value #endif ); }; template <typename O, typename R> struct enable_if_memzero_initializable - : enable_if_c<container_detail::is_memzero_initializable<O>::value, R> + : enable_if_c<dtl::is_memzero_initializable<O>::value, R> {}; template <typename O, typename R> struct disable_if_memzero_initializable - : enable_if_c<!container_detail::is_memzero_initializable<O>::value, R> + : enable_if_c<!dtl::is_memzero_initializable<O>::value, R> {}; template <typename I, typename R> struct enable_if_trivially_destructible - : enable_if_c < container_detail::is_trivially_destructible + : enable_if_c < dtl::is_trivially_destructible <typename boost::container::iterator_traits<I>::value_type>::value , R> {}; template <typename I, typename R> struct disable_if_trivially_destructible - : enable_if_c <!container_detail::is_trivially_destructible + : enable_if_c <!dtl::is_trivially_destructible <typename boost::container::iterator_traits<I>::value_type>::value , R> {}; -} //namespace container_detail { +} //namespace dtl { ////////////////////////////////////////////////////////////////////////////// // @@ -281,7 +273,7 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_move_alloc(Allocator &a, I f, I l, F r) { F back = r; @@ -305,9 +297,9 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_move_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -326,7 +318,7 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_move_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) { F back = r; @@ -350,9 +342,9 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_move_alloc_n(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -371,7 +363,7 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type +inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type uninitialized_move_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) { F back = r; @@ -395,9 +387,9 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type +inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, I>::type uninitialized_move_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -416,7 +408,7 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_copy_alloc(Allocator &a, I f, I l, F r) { F back = r; @@ -440,9 +432,9 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_copy_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -461,7 +453,7 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_copy_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) { F back = r; @@ -485,9 +477,9 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type uninitialized_copy_alloc_n(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -506,7 +498,7 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type +inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type uninitialized_copy_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) { F back = r; @@ -530,9 +522,9 @@ template <typename Allocator, typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type +inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, I>::type uninitialized_copy_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -550,7 +542,7 @@ inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, template <typename Allocator, typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memzero_initializable<F, F>::type +inline typename dtl::disable_if_memzero_initializable<F, F>::type uninitialized_value_init_alloc_n(Allocator &a, typename boost::container::allocator_traits<Allocator>::size_type n, F r) { F back = r; @@ -573,7 +565,7 @@ inline typename container_detail::disable_if_memzero_initializable<F, F>::type template <typename Allocator, typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memzero_initializable<F, F>::type +inline typename dtl::enable_if_memzero_initializable<F, F>::type uninitialized_value_init_alloc_n(Allocator &, typename boost::container::allocator_traits<Allocator>::size_type n, F r) { typedef typename boost::container::iterator_traits<F>::value_type value_type; @@ -698,7 +690,7 @@ inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename boost::co template <typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type copy(I f, I l, F r) { while (f != l) { @@ -711,9 +703,9 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F template <typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type copy(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -725,7 +717,7 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type copy_n(I f, U n, F r) { while (n--) { @@ -739,9 +731,9 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type copy_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -753,7 +745,7 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type copy_n_source(I f, U n, F r) { while (n--) { @@ -767,9 +759,9 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type copy_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -781,7 +773,7 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type copy_n_source_dest(I f, U n, F &r) { while (n--) { @@ -795,9 +787,9 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type copy_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source_dest(f, n, r); } +{ return dtl::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -808,7 +800,7 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I> template <typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type move(I f, I l, F r) { while (f != l) { @@ -821,9 +813,9 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F template <typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type move(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -835,7 +827,7 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type move_n(I f, U n, F r) { while (n--) { @@ -849,9 +841,9 @@ template <typename I, // I models InputIterator typename U, // U models unsigned integral constant typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type move_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -863,7 +855,7 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F> template <typename I, // I models BidirectionalIterator typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type move_backward(I f, I l, F r) { while (f != l) { @@ -876,7 +868,7 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F template <typename I, // I models InputIterator typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type move_backward(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iterator_traits<I>::value_type value_type; @@ -896,7 +888,7 @@ template <typename I // I models InputIterator ,typename U // U models unsigned integral constant ,typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type move_n_source_dest(I f, U n, F &r) { while (n--) { @@ -910,9 +902,9 @@ template <typename I // I models InputIterator ,typename U // U models unsigned integral constant ,typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type move_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source_dest(f, n, r); } +{ return dtl::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -924,7 +916,7 @@ template <typename I // I models InputIterator ,typename U // U models unsigned integral constant ,typename F> // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type move_n_source(I f, U n, F r) { while (n--) { @@ -938,9 +930,9 @@ template <typename I // I models InputIterator ,typename U // U models unsigned integral constant ,typename F> // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type +inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type move_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -952,7 +944,7 @@ template <typename Allocator ,typename I // I models InputIterator ,typename U> // U models unsigned integral constant -inline typename container_detail::disable_if_trivially_destructible<I, void>::type +inline typename dtl::disable_if_trivially_destructible<I, void>::type destroy_alloc_n(Allocator &a, I f, U n) { while(n){ @@ -966,7 +958,7 @@ template <typename Allocator ,typename I // I models InputIterator ,typename U> // U models unsigned integral constant -inline typename container_detail::enable_if_trivially_destructible<I, void>::type +inline typename dtl::enable_if_trivially_destructible<I, void>::type destroy_alloc_n(Allocator &, I, U) {} @@ -982,7 +974,7 @@ template ,typename F // F models ForwardIterator ,typename G // G models ForwardIterator > -inline typename container_detail::disable_if_memtransfer_copy_assignable<F, G, void>::type +inline typename dtl::disable_if_memtransfer_copy_assignable<F, G, void>::type deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i , G large_range_f, typename allocator_traits<Allocator>::size_type n_j) { @@ -1002,21 +994,21 @@ template ,typename F // F models ForwardIterator ,typename G // G models ForwardIterator > -inline typename container_detail::enable_if_c - < container_detail::is_memtransfer_copy_assignable<F, G>::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false +inline typename dtl::enable_if_c + < dtl::is_memtransfer_copy_assignable<F, G>::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false , void>::type deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i , G large_range_f, typename allocator_traits<Allocator>::size_type n_j) { typedef typename allocator_traits<Allocator>::value_type value_type; - typedef typename container_detail::aligned_storage - <MaxTmpBytes, container_detail::alignment_of<value_type>::value>::type storage_type; + typedef typename dtl::aligned_storage + <MaxTmpBytes, dtl::alignment_of<value_type>::value>::type storage_type; storage_type storage; const std::size_t n_i_bytes = sizeof(value_type)*n_i; void *const large_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(large_range_f)); void *const short_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(short_range_f)); - void *const stora_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(storage)); + void *const stora_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(storage.data)); std::memcpy(stora_ptr, large_ptr, n_i_bytes); std::memcpy(large_ptr, short_ptr, n_i_bytes); std::memcpy(short_ptr, stora_ptr, n_i_bytes); @@ -1032,22 +1024,22 @@ template ,typename F // F models ForwardIterator ,typename G // G models ForwardIterator > -inline typename container_detail::enable_if_c - < container_detail::is_memtransfer_copy_assignable<F, G>::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage) +inline typename dtl::enable_if_c + < dtl::is_memtransfer_copy_assignable<F, G>::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage) , void>::type deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i , G large_range_f, typename allocator_traits<Allocator>::size_type n_j) { typedef typename allocator_traits<Allocator>::value_type value_type; - typedef typename container_detail::aligned_storage - <DeepSwapAllocNMaxStorage, container_detail::alignment_of<value_type>::value>::type storage_type; + typedef typename dtl::aligned_storage + <DeepSwapAllocNMaxStorage, dtl::alignment_of<value_type>::value>::type storage_type; storage_type storage; const std::size_t sizeof_storage = sizeof(storage); std::size_t n_i_bytes = sizeof(value_type)*n_i; char *large_ptr = static_cast<char*>(static_cast<void*>(boost::movelib::iterator_to_raw_pointer(large_range_f))); char *short_ptr = static_cast<char*>(static_cast<void*>(boost::movelib::iterator_to_raw_pointer(short_range_f))); - char *stora_ptr = static_cast<char*>(static_cast<void*>(&storage)); + char *stora_ptr = static_cast<char*>(static_cast<void*>(storage.data)); std::size_t szt_times = n_i_bytes/sizeof_storage; const std::size_t szt_rem = n_i_bytes%sizeof_storage; diff --git a/boost/container/detail/destroyers.hpp b/boost/container/detail/destroyers.hpp index c3a5d90af3..9b0be44e66 100644 --- a/boost/container/detail/destroyers.hpp +++ b/boost/container/detail/destroyers.hpp @@ -30,7 +30,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { //!A deleter for scoped_ptr that deallocates the memory //!allocated for an object using a STL allocator. @@ -39,8 +39,8 @@ struct scoped_deallocator { typedef allocator_traits<Allocator> allocator_traits_type; typedef typename allocator_traits_type::pointer pointer; - typedef container_detail::integral_constant<unsigned, - boost::container::container_detail:: + typedef dtl::integral_constant<unsigned, + boost::container::dtl:: version<Allocator>::value> alloc_version; private: @@ -142,8 +142,8 @@ struct scoped_destroy_deallocator typedef boost::container::allocator_traits<Allocator> AllocTraits; typedef typename AllocTraits::pointer pointer; typedef typename AllocTraits::size_type size_type; - typedef container_detail::integral_constant<unsigned, - boost::container::container_detail:: + typedef dtl::integral_constant<unsigned, + boost::container::dtl:: version<Allocator>::value> alloc_version; scoped_destroy_deallocator(pointer p, Allocator& a) @@ -296,8 +296,8 @@ class allocator_destroyer typedef boost::container::allocator_traits<Allocator> AllocTraits; typedef typename AllocTraits::value_type value_type; typedef typename AllocTraits::pointer pointer; - typedef container_detail::integral_constant<unsigned, - boost::container::container_detail:: + typedef dtl::integral_constant<unsigned, + boost::container::dtl:: version<Allocator>::value> alloc_version; private: @@ -369,7 +369,7 @@ class allocator_multialloc_chain_node_deallocator } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/dispatch_uses_allocator.hpp b/boost/container/detail/dispatch_uses_allocator.hpp index 946fdf615b..0b8cfea66c 100644 --- a/boost/container/detail/dispatch_uses_allocator.hpp +++ b/boost/container/detail/dispatch_uses_allocator.hpp @@ -35,7 +35,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { // Check if we can detect is_convertible using advanced SFINAE expressions @@ -110,10 +110,10 @@ template < typename ConstructAlloc , typename T , class ...Args > -inline typename container_detail::enable_if_and +inline typename dtl::enable_if_and < void - , container_detail::is_not_pair<T> - , container_detail::not_< uses_allocator<T, ArgAlloc> > + , dtl::is_not_pair<T> + , dtl::not_< uses_allocator<T, ArgAlloc> > >::type dispatch_uses_allocator ( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args) { @@ -127,9 +127,9 @@ template < typename ConstructAlloc , typename T , class ...Args > -inline typename container_detail::enable_if_and +inline typename dtl::enable_if_and < void - , container_detail::is_not_pair<T> + , dtl::is_not_pair<T> , uses_allocator<T, ArgAlloc> , is_constructible_with_allocator_prefix<T, ArgAlloc, Args...> >::type dispatch_uses_allocator @@ -146,11 +146,11 @@ template < typename ConstructAlloc , typename T , class ...Args > -inline typename container_detail::enable_if_and +inline typename dtl::enable_if_and < void - , container_detail::is_not_pair<T> + , dtl::is_not_pair<T> , uses_allocator<T, ArgAlloc> - , container_detail::not_<is_constructible_with_allocator_prefix<T, ArgAlloc, Args...> > + , dtl::not_<is_constructible_with_allocator_prefix<T, ArgAlloc, Args...> > >::type dispatch_uses_allocator ( ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args) { @@ -162,10 +162,10 @@ inline typename container_detail::enable_if_and #define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ template <typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ - inline typename container_detail::enable_if_and\ + inline typename dtl::enable_if_and\ < void\ - , container_detail::is_not_pair<T>\ - , container_detail::not_<uses_allocator<T, ArgAlloc> >\ + , dtl::is_not_pair<T>\ + , dtl::not_<uses_allocator<T, ArgAlloc> >\ >::type\ dispatch_uses_allocator\ (ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ @@ -179,9 +179,9 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR #define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ - inline typename container_detail::enable_if_and\ + inline typename dtl::enable_if_and\ < void\ - , container_detail::is_not_pair<T>\ + , dtl::is_not_pair<T>\ , uses_allocator<T, ArgAlloc>\ , is_constructible_with_allocator_prefix<T, ArgAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N>\ >::type\ @@ -197,11 +197,11 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR #define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ - inline typename container_detail::enable_if_and\ + inline typename dtl::enable_if_and\ < void\ - , container_detail::is_not_pair<T>\ + , dtl::is_not_pair<T>\ , uses_allocator<T, ArgAlloc>\ - , container_detail::not_<is_constructible_with_allocator_prefix<T, ArgAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N> >\ + , dtl::not_<is_constructible_with_allocator_prefix<T, ArgAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N> >\ >::type\ dispatch_uses_allocator\ (ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ @@ -219,18 +219,18 @@ template < typename ConstructAlloc , typename ArgAlloc , typename Pair > inline -BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_detail::is_pair<Pair> >::type) +BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if<dtl::is_pair<Pair> >::type) dispatch_uses_allocator ( ConstructAlloc & construct_alloc , BOOST_FWD_REF(ArgAlloc) arg_alloc , Pair* p) { - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first)); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first)); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second)); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second)); } BOOST_CATCH(...) { - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first)); + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first)); BOOST_RETHROW } BOOST_CATCH_END @@ -240,18 +240,18 @@ BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_deta template < typename ConstructAlloc , typename ArgAlloc , class Pair, class U, class V> -BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_detail::is_pair<Pair> >::type) +BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if<dtl::is_pair<Pair> >::type) dispatch_uses_allocator ( ConstructAlloc & construct_alloc , BOOST_FWD_REF(ArgAlloc) arg_alloc , Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) { - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward<U>(x)); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<U>(x)); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second), ::boost::forward<V>(y)); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<V>(y)); } BOOST_CATCH(...){ - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first)); + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first)); BOOST_RETHROW } BOOST_CATCH_END @@ -260,7 +260,7 @@ BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_deta template < typename ConstructAlloc , typename ArgAlloc , class Pair, class Pair2> -BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if< container_detail::is_pair<Pair> >::type) +BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if< dtl::is_pair<Pair> >::type) dispatch_uses_allocator (ConstructAlloc & construct_alloc , BOOST_FWD_REF(ArgAlloc) arg_alloc @@ -270,10 +270,10 @@ BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if< container_det template < typename ConstructAlloc , typename ArgAlloc , class Pair, class Pair2> -typename container_detail::enable_if_and +typename dtl::enable_if_and < void - , container_detail::is_pair<Pair> - , container_detail::not_<boost::move_detail::is_reference<Pair2> > >::type //This is needed for MSVC10 and ambiguous overloads + , dtl::is_pair<Pair> + , dtl::not_<boost::move_detail::is_reference<Pair2> > >::type //This is needed for MSVC10 and ambiguous overloads dispatch_uses_allocator (ConstructAlloc & construct_alloc , BOOST_FWD_REF(ArgAlloc) arg_alloc @@ -286,20 +286,20 @@ typename container_detail::enable_if_and template< typename ConstructAlloc, typename ArgAlloc, class Pair \ , template<class, class, class, class, class, class, class, class, class, class> class BoostTuple \ BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ -typename container_detail::enable_if< container_detail::is_pair<Pair> >::type\ +typename dtl::enable_if< dtl::is_pair<Pair> >::type\ dispatch_uses_allocator( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\ , BoostTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::boost::tuples::null_type)> p\ , BoostTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::boost::tuples::null_type)> q)\ {\ (void)p; (void)q;\ (dispatch_uses_allocator)\ - (construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\ + (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\ BOOST_TRY{\ (dispatch_uses_allocator)\ - (construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\ + (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\ }\ BOOST_CATCH(...) {\ - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first));\ + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\ BOOST_RETHROW\ }\ BOOST_CATCH_END\ @@ -317,12 +317,12 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO , Tuple<Args1...>& t1, Tuple<Args2...>& t2, index_tuple<Indexes1...>, index_tuple<Indexes2...>) { (void)t1; (void)t2; - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(pair->first), ::boost::forward<Args1>(get<Indexes1>(t1))...); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(pair->first), ::boost::forward<Args1>(get<Indexes1>(t1))...); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(pair->second), ::boost::forward<Args2>(get<Indexes2>(t2))...); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(pair->second), ::boost::forward<Args2>(get<Indexes2>(t2))...); } BOOST_CATCH(...){ - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first)); + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first)); BOOST_RETHROW } BOOST_CATCH_END @@ -330,7 +330,7 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO template< typename ConstructAlloc, typename ArgAlloc, class Pair , template<class ...> class Tuple, class... Args1, class... Args2> - typename container_detail::enable_if< container_detail::is_pair<Pair> >::type + typename dtl::enable_if< dtl::is_pair<Pair> >::type dispatch_uses_allocator( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t , Tuple<Args1...> t1, Tuple<Args2...> t2) { @@ -346,20 +346,20 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO template< typename ConstructAlloc, typename ArgAlloc, class Pair\ , template<class, class, class, class, class, class, class, class, class, class> class StdTuple\ BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ - typename container_detail::enable_if< container_detail::is_pair<Pair> >::type\ + typename dtl::enable_if< dtl::is_pair<Pair> >::type\ dispatch_uses_allocator(ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\ , StdTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::std::tr1::_Nil)> p\ , StdTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::std::tr1::_Nil)> q)\ {\ (void)p; (void)q;\ (dispatch_uses_allocator)\ - (construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ + (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ BOOST_TRY{\ (dispatch_uses_allocator)\ - (construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ + (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ }\ BOOST_CATCH(...) {\ - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first));\ + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\ BOOST_RETHROW\ }\ BOOST_CATCH_END\ @@ -380,7 +380,7 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO template< typename ConstructAlloc, typename ArgAlloc, class Pair\ , template<BOOST_MOVE_REPEAT(_VARIADIC_MAX, class), class, class, class> class StdTuple \ BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ - typename container_detail::enable_if< container_detail::is_pair<Pair> >::type\ + typename dtl::enable_if< dtl::is_pair<Pair> >::type\ dispatch_uses_allocator\ ( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\ , StdTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(BOOST_MOVE_ADD(_VARIADIC_MAX, 3),N),::std::_Nil) > p\ @@ -388,13 +388,13 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO {\ (void)p; (void)q;\ (dispatch_uses_allocator)\ - (construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ + (construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ BOOST_TRY{\ (dispatch_uses_allocator)\ - (construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ + (construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ }\ BOOST_CATCH(...) {\ - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first));\ + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\ BOOST_RETHROW\ }\ BOOST_CATCH_END\ @@ -411,16 +411,16 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO template < typename ConstructAlloc , typename ArgAlloc , class Pair, class KeyType, class ... Args> -typename container_detail::enable_if< container_detail::is_pair<Pair>, void >::type +typename dtl::enable_if< dtl::is_pair<Pair>, void >::type dispatch_uses_allocator (ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) { - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward<KeyType>(k)); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k)); BOOST_TRY{ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second), ::boost::forward<Args>(args)...); + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<Args>(args)...); } BOOST_CATCH(...) { - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first)); + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first)); BOOST_RETHROW } BOOST_CATCH_END @@ -430,18 +430,18 @@ typename container_detail::enable_if< container_detail::is_pair<Pair>, void >::t #define BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE(N) \ template <typename ConstructAlloc, typename ArgAlloc, class Pair, class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ - inline typename container_detail::enable_if\ - < container_detail::is_pair<Pair>, void >::type\ + inline typename dtl::enable_if\ + < dtl::is_pair<Pair>, void >::type\ dispatch_uses_allocator\ (ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, \ BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward<KeyType>(k));\ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k));\ BOOST_TRY{\ - (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ }\ BOOST_CATCH(...) {\ - allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first));\ + allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));\ BOOST_RETHROW\ }\ BOOST_CATCH_END\ @@ -452,7 +452,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE #endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -} //namespace container_detail +} //namespace dtl }} // namespace boost { namespace container { diff --git a/boost/container/detail/flat_tree.hpp b/boost/container/detail/flat_tree.hpp index 319cad69a7..5f212e3fc8 100644 --- a/boost/container/detail/flat_tree.hpp +++ b/boost/container/detail/flat_tree.hpp @@ -47,6 +47,7 @@ #include <boost/move/iterator.hpp> #include <boost/move/adl_move_swap.hpp> #include <boost/move/algo/adaptive_sort.hpp> +#include <boost/move/algo/detail/pdqsort.hpp> #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include <boost/move/detail/fwd_macros.hpp> @@ -56,7 +57,7 @@ //merge_unique #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME merge_unique -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3 @@ -64,7 +65,7 @@ //merge_equal #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME merge -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3 @@ -72,7 +73,7 @@ //index_of #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME index_of -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 @@ -80,7 +81,7 @@ //nth #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME nth -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 @@ -88,7 +89,7 @@ //reserve #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME reserve -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 @@ -96,7 +97,7 @@ //capacity #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME capacity -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 @@ -106,196 +107,297 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { + +/////////////////////////////////////// +// +// Helper functions to merge elements +// +/////////////////////////////////////// BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(stored_allocator_type) -template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::true_) +/////////////////////////////////////// +// +// flat_tree_container_inplace_merge +// +/////////////////////////////////////// +template<class SequenceContainer, class Compare> +void flat_tree_container_inplace_merge //is_contiguous_container == true + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp , dtl::true_) { - dest.merge(first, last, comp); + typedef typename SequenceContainer::value_type value_type; + value_type *const braw = boost::movelib::iterator_to_raw_pointer(dest.begin()); + value_type *const iraw = boost::movelib::iterator_to_raw_pointer(it); + value_type *const eraw = boost::movelib::iterator_to_raw_pointer(dest.end()); + boost::movelib::adaptive_merge(braw, iraw, eraw, comp, eraw, dest.capacity()- dest.size()); } -template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal_non_merge_member - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::true_) +template<class SequenceContainer, class Compare> +void flat_tree_container_inplace_merge //is_contiguous_container == false + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp, dtl::false_) { - typedef typename SequenceContainer::iterator iterator; - typedef typename SequenceContainer::value_type value_type; + boost::movelib::adaptive_merge(dest.begin(), it, dest.end(), comp); +} - iterator const it = dest.insert( dest.end(), first, last ); - value_type *const braw = boost::movelib::iterator_to_raw_pointer(dest.begin()); +/////////////////////////////////////// +// +// flat_tree_container_inplace_sort_ending +// +/////////////////////////////////////// +template<class SequenceContainer, class Compare> +void flat_tree_container_inplace_sort_ending //is_contiguous_container == true + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp, dtl::true_) +{ + typedef typename SequenceContainer::value_type value_type; value_type *const iraw = boost::movelib::iterator_to_raw_pointer(it); value_type *const eraw = boost::movelib::iterator_to_raw_pointer(dest.end()); - value_type *const sraw = boost::movelib::iterator_to_raw_pointer(dest.begin()+dest.size()); - boost::movelib::adaptive_sort(iraw, eraw, comp, sraw, dest.capacity()); - boost::movelib::adaptive_merge(braw, iraw, eraw, comp, sraw, dest.capacity()- dest.size()); + boost::movelib::adaptive_sort(iraw, eraw, comp, eraw, dest.capacity()- dest.size()); } -template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal_non_merge_member - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::false_) +template<class SequenceContainer, class Compare> +void flat_tree_container_inplace_sort_ending //is_contiguous_container == false + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp , dtl::false_) { - typedef typename SequenceContainer::iterator iterator; - - iterator const it = dest.insert( dest.end(), first, last ); boost::movelib::adaptive_sort(it, dest.end(), comp); - boost::movelib::adaptive_merge(dest.begin(), it, dest.end(), comp); } +/////////////////////////////////////// +// +// flat_tree_merge +// +/////////////////////////////////////// template<class SequenceContainer, class Iterator, class Compare> BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::false_) + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::true_) { - (flat_tree_merge_equal_non_merge_member)( dest, first, last, comp - , container_detail::bool_<is_contiguous_container<SequenceContainer>::value>()); + dest.merge(first, last, comp); } template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::true_) +BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal //has_merge_unique == false + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::false_) +{ + typedef typename SequenceContainer::iterator iterator; + iterator const it = dest.insert( dest.end(), first, last ); + dtl::bool_<is_contiguous_container<SequenceContainer>::value> contiguous_tag; + (flat_tree_container_inplace_merge)(dest, it, comp, contiguous_tag); +} + +/////////////////////////////////////// +// +// flat_tree_merge_unique +// +/////////////////////////////////////// +template<class SequenceContainer, class Iterator, class Compare> +BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == true + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::true_) { dest.merge_unique(first, last, comp); } template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::false_) +BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == false + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::false_) { - (flat_tree_merge_equal)(dest, first, last, comp, container_detail::false_()); - dest.erase(boost::movelib::unique - (dest.begin(), dest.end(), boost::movelib::negate<Compare>(comp)), dest.cend()); + typedef typename SequenceContainer::iterator iterator; + typedef typename SequenceContainer::size_type size_type; + + size_type const old_sz = dest.size(); + iterator const first_new = dest.insert(dest.cend(), first, last ); + iterator e = boost::movelib::inplace_set_difference(first_new, dest.end(), dest.begin(), first_new, comp); + dest.erase(e, dest.end()); + dtl::bool_<is_contiguous_container<SequenceContainer>::value> contiguous_tag; + (flat_tree_container_inplace_merge)(dest, dest.begin()+old_sz, comp, contiguous_tag); } +/////////////////////////////////////// +// +// flat_tree_index_of +// +/////////////////////////////////////// template<class SequenceContainer, class Iterator> BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_index_of - (SequenceContainer& cont, Iterator p, container_detail::true_) + flat_tree_index_of // has_index_of == true + (SequenceContainer& cont, Iterator p, dtl::true_) { return cont.index_of(p); } template<class SequenceContainer, class Iterator> BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_index_of - (SequenceContainer& cont, Iterator p, container_detail::false_) + flat_tree_index_of // has_index_of == false + (SequenceContainer& cont, Iterator p, dtl::false_) { typedef typename SequenceContainer::size_type size_type; return static_cast<size_type>(p - cont.begin()); } +/////////////////////////////////////// +// +// flat_tree_nth +// +/////////////////////////////////////// template<class Iterator, class SequenceContainer> BOOST_CONTAINER_FORCEINLINE Iterator - flat_tree_nth - (SequenceContainer& cont, typename SequenceContainer::size_type n, container_detail::true_) + flat_tree_nth // has_nth == true + (SequenceContainer& cont, typename SequenceContainer::size_type n, dtl::true_) { return cont.nth(n); } template<class Iterator, class SequenceContainer> BOOST_CONTAINER_FORCEINLINE Iterator - flat_tree_nth - (SequenceContainer& cont, typename SequenceContainer::size_type n, container_detail::false_) + flat_tree_nth // has_nth == false + (SequenceContainer& cont, typename SequenceContainer::size_type n, dtl::false_) { return cont.begin()+ n; } +/////////////////////////////////////// +// +// flat_tree_get_stored_allocator +// +/////////////////////////////////////// template<class SequenceContainer> BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::stored_allocator_type & - flat_tree_get_stored_allocator - (SequenceContainer& cont, container_detail::true_) + flat_tree_get_stored_allocator // has_get_stored_allocator == true + (SequenceContainer& cont, dtl::true_) { return cont.get_stored_allocator(); } template<class SequenceContainer> BOOST_CONTAINER_FORCEINLINE const typename SequenceContainer::stored_allocator_type & - flat_tree_get_stored_allocator - (const SequenceContainer& cont, container_detail::true_) + flat_tree_get_stored_allocator // has_get_stored_allocator == true + (const SequenceContainer& cont, dtl::true_) { return cont.get_stored_allocator(); } template<class SequenceContainer> BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::allocator_type - flat_tree_get_stored_allocator - (SequenceContainer& cont, container_detail::false_) + flat_tree_get_stored_allocator // has_get_stored_allocator == false + (SequenceContainer& cont, dtl::false_) { return cont.get_allocator(); } +/////////////////////////////////////// +// +// flat_tree_adopt_sequence_equal +// +/////////////////////////////////////// template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_equal(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::true_) +void flat_tree_sort_contiguous_to_adopt // is_contiguous_container == true + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp) { - tseq.clear(); - boost::movelib::adaptive_sort - (boost::movelib::iterator_to_raw_pointer(seq.begin()) - , boost::movelib::iterator_to_raw_pointer(seq.end()) - , comp - , boost::movelib::iterator_to_raw_pointer(tseq.begin() + tseq.size()) - , tseq.capacity() - tseq.size()); + if(tseq.capacity() >= (seq.capacity() - seq.size())) { + tseq.clear(); + boost::movelib::adaptive_sort + (boost::movelib::iterator_to_raw_pointer(seq.begin()) + , boost::movelib::iterator_to_raw_pointer(seq.end()) + , comp + , boost::movelib::iterator_to_raw_pointer(tseq.begin()) + , tseq.capacity()); + } + else{ + boost::movelib::adaptive_sort + (boost::movelib::iterator_to_raw_pointer(seq.begin()) + , boost::movelib::iterator_to_raw_pointer(seq.end()) + , comp + , boost::movelib::iterator_to_raw_pointer(seq.end()) + , seq.capacity() - seq.size()); + } +} + +template<class SequenceContainer, class Compare> +void flat_tree_adopt_sequence_equal // is_contiguous_container == true + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::true_) +{ + flat_tree_sort_contiguous_to_adopt(tseq, boost::move(seq), comp); tseq = boost::move(seq); } template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_equal(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::false_) +void flat_tree_adopt_sequence_equal // is_contiguous_container == false + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::false_) { boost::movelib::adaptive_sort(seq.begin(), seq.end(), comp); tseq = boost::move(seq); } +/////////////////////////////////////// +// +// flat_tree_adopt_sequence_unique +// +/////////////////////////////////////// template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_unique(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::true_) +void flat_tree_adopt_sequence_unique// is_contiguous_container == true + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::true_) { - boost::movelib::adaptive_sort + boost::movelib::pdqsort ( boost::movelib::iterator_to_raw_pointer(seq.begin()) , boost::movelib::iterator_to_raw_pointer(seq.end()) - , comp - , boost::movelib::iterator_to_raw_pointer(tseq.begin() + tseq.size()) - , tseq.capacity() - tseq.size()); + , comp); seq.erase(boost::movelib::unique - ( seq.begin(), seq.end(), boost::movelib::negate<Compare>(comp)) - , seq.cend()); + (seq.begin(), seq.end(), boost::movelib::negate<Compare>(comp)), seq.cend()); tseq = boost::move(seq); } template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_unique(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::false_) +void flat_tree_adopt_sequence_unique// is_contiguous_container == false + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::false_) { - boost::movelib::adaptive_sort(seq.begin(), seq.end(), comp); + boost::movelib::pdqsort(seq.begin(), seq.end(), comp); seq.erase(boost::movelib::unique (seq.begin(), seq.end(), boost::movelib::negate<Compare>(comp)), seq.cend()); tseq = boost::move(seq); } +/////////////////////////////////////// +// +// flat_tree_reserve +// +/////////////////////////////////////// template<class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE void - flat_tree_reserve(SequenceContainer &tseq, typename SequenceContainer::size_type cap, container_detail::true_) +BOOST_CONTAINER_FORCEINLINE void // has_reserve == true + flat_tree_reserve(SequenceContainer &tseq, typename SequenceContainer::size_type cap, dtl::true_) { tseq.reserve(cap); } template<class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE void - flat_tree_reserve(SequenceContainer &, typename SequenceContainer::size_type, container_detail::false_) +BOOST_CONTAINER_FORCEINLINE void // has_reserve == false + flat_tree_reserve(SequenceContainer &, typename SequenceContainer::size_type, dtl::false_) { } -template<class SequenceContainer> +/////////////////////////////////////// +// +// flat_tree_capacity +// +/////////////////////////////////////// +template<class SequenceContainer> // has_capacity == true BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_capacity(const SequenceContainer &tseq, container_detail::true_) + flat_tree_capacity(const SequenceContainer &tseq, dtl::true_) { return tseq.capacity(); } -template<class SequenceContainer> +template<class SequenceContainer> // has_capacity == false BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_capacity(const SequenceContainer &tseq, container_detail::false_) + flat_tree_capacity(const SequenceContainer &tseq, dtl::false_) { return tseq.size(); } +/////////////////////////////////////// +// +// flat_tree_value_compare +// +/////////////////////////////////////// + template<class Compare, class Value, class KeyOfValue> class flat_tree_value_compare : private Compare @@ -324,21 +426,14 @@ class flat_tree_value_compare Compare &get_comp() { return *this; } }; -/* -template<class Pointer> -struct get_flat_tree_iterators -{ - typedef typename boost::container::container_detail:: - vec_iterator<Pointer, false> iterator; - typedef typename boost::container::container_detail:: - vec_iterator<Pointer, true > const_iterator; - typedef boost::container::reverse_iterator<iterator> reverse_iterator; - typedef boost::container::reverse_iterator<const_iterator> const_reverse_iterator; -}; -*/ +/////////////////////////////////////// +// +// select_container_type +// +/////////////////////////////////////// template < class Value, class AllocatorOrContainer - , bool = boost::container::container_detail::is_container<AllocatorOrContainer>::value > + , bool = boost::container::dtl::is_container<AllocatorOrContainer>::value > struct select_container_type { typedef AllocatorOrContainer type; @@ -350,6 +445,12 @@ struct select_container_type<Value, AllocatorOrContainer, false> typedef boost::container::vector<Value, AllocatorOrContainer> type; }; + +/////////////////////////////////////// +// +// flat_tree +// +/////////////////////////////////////// template <class Value, class KeyOfValue, class Compare, class AllocatorOrContainer> class flat_tree @@ -452,20 +553,20 @@ class flat_tree //!Standard extension typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT - (boost::container::container_detail::, container_type + (boost::container::dtl::, container_type ,stored_allocator_type, allocator_type) stored_allocator_type; static const bool has_stored_allocator_type = - BOOST_INTRUSIVE_HAS_TYPE(boost::container::container_detail::, container_type, stored_allocator_type); + BOOST_INTRUSIVE_HAS_TYPE(boost::container::dtl::, container_type, stored_allocator_type); private: typedef allocator_traits<stored_allocator_type> stored_allocator_traits; public: - typedef typename container_detail::if_c + typedef typename dtl::if_c <has_stored_allocator_type, const stored_allocator_type &, allocator_type>::type get_stored_allocator_const_return_t; - typedef typename container_detail::if_c + typedef typename dtl::if_c <has_stored_allocator_type, stored_allocator_type &, allocator_type>::type get_stored_allocator_noconst_return_t; BOOST_CONTAINER_FORCEINLINE flat_tree() @@ -489,7 +590,7 @@ class flat_tree { } BOOST_CONTAINER_FORCEINLINE flat_tree(BOOST_RV_REF(flat_tree) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) : m_data(boost::move(x.m_data)) { } @@ -599,7 +700,7 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE flat_tree& operator=(BOOST_RV_REF(flat_tree) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable<Compare>::value) + boost::container::dtl::is_nothrow_move_assignable<Compare>::value) { m_data = boost::move(x.m_data); return *this; } BOOST_CONTAINER_FORCEINLINE const value_compare &priv_value_comp() const @@ -632,12 +733,12 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const { - return flat_tree_get_stored_allocator(this->m_data.m_seq, container_detail::bool_<has_stored_allocator_type>()); + return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_<has_stored_allocator_type>()); } BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() { - return flat_tree_get_stored_allocator(this->m_data.m_seq, container_detail::bool_<has_stored_allocator_type>()); + return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_<has_stored_allocator_type>()); } BOOST_CONTAINER_FORCEINLINE iterator begin() @@ -687,7 +788,7 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE void swap(flat_tree& other) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable<Compare>::value ) + && boost::container::dtl::is_nothrow_swappable<Compare>::value ) { this->m_data.swap(other.m_data); } public: @@ -767,109 +868,51 @@ class flat_tree template <class InIt> void insert_unique(InIt first, InIt last) { - for ( ; first != last; ++first){ - this->insert_unique(*first); - } - } + dtl::bool_<is_contiguous_container<container_type>::value> contiguous_tag; + container_type &seq = this->m_data.m_seq; + value_compare &val_cmp = this->priv_value_comp(); - template <class InIt> - void insert_equal(InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < container_detail::is_input_iterator<InIt>::value - >::type * = 0 - #endif - ) - { this->priv_insert_equal_loop(first, last); } + //Step 1: put new elements in the back + typename container_type::iterator const it = seq.insert(seq.cend(), first, last); + + //Step 2: sort them + boost::movelib::pdqsort(it, seq.end(), val_cmp); + + //Step 3: only left unique values from the back not already present in the original range + typename container_type::iterator const e = boost::movelib::inplace_set_unique_difference + (it, seq.end(), seq.begin(), it, val_cmp); + seq.erase(e, seq.cend()); + + //Step 4: merge both ranges + (flat_tree_container_inplace_merge)(seq, it, this->priv_value_comp(), contiguous_tag); + } template <class InIt> - void insert_equal(InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !container_detail::is_input_iterator<InIt>::value - >::type * = 0 - #endif - ) + void insert_equal(InIt first, InIt last) { - const size_type len = static_cast<size_type>(boost::container::iterator_distance(first, last)); - this->reserve(this->size()+len); - this->priv_insert_equal_loop(first, last); + dtl::bool_<is_contiguous_container<container_type>::value> contiguous_tag; + container_type &seq = this->m_data.m_seq; + typename container_type::iterator const it = seq.insert(seq.cend(), first, last); + (flat_tree_container_inplace_sort_ending)(seq, it, this->priv_value_comp(), contiguous_tag); + (flat_tree_container_inplace_merge) (seq, it, this->priv_value_comp(), contiguous_tag); } //Ordered template <class InIt> - void insert_equal(ordered_range_t, InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < container_detail::is_input_iterator<InIt>::value - >::type * = 0 - #endif - ) - { this->priv_insert_equal_loop_ordered(first, last); } - - template <class FwdIt> - void insert_equal(ordered_range_t, FwdIt first, FwdIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !container_detail::is_input_iterator<FwdIt>::value && - container_detail::is_forward_iterator<FwdIt>::value - >::type * = 0 - #endif - ) - { - const size_type len = static_cast<size_type>(boost::container::iterator_distance(first, last)); - this->reserve(this->size()+len); - this->priv_insert_equal_loop_ordered(first, last); - } - - template <class BidirIt> - void insert_equal(ordered_range_t, BidirIt first, BidirIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::disable_if_or - < void - , container_detail::is_input_iterator<BidirIt> - , container_detail::is_forward_iterator<BidirIt> - >::type * = 0 - #endif - ) - { - const bool value = boost::container::container_detail:: - has_member_function_callable_with_merge_unique<container_type, iterator, iterator, value_compare>::value; - (flat_tree_merge_equal)(this->m_data.m_seq, first, last, this->priv_value_comp(), container_detail::bool_<value>()); + void insert_equal(ordered_range_t, InIt first, InIt last) + { + const bool value = boost::container::dtl:: + has_member_function_callable_with_merge_unique<container_type, InIt, InIt, value_compare>::value; + (flat_tree_merge_equal)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_<value>()); } template <class InIt> - void insert_unique(ordered_unique_range_t, InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_or - < void - , container_detail::is_input_iterator<InIt> - , container_detail::is_forward_iterator<InIt> - >::type * = 0 - #endif - ) - { - const_iterator pos(this->cend()); - for ( ; first != last; ++first){ - pos = this->insert_unique(pos, *first); - ++pos; - } - } - - template <class BidirIt> - void insert_unique(ordered_unique_range_t, BidirIt first, BidirIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !(container_detail::is_input_iterator<BidirIt>::value || - container_detail::is_forward_iterator<BidirIt>::value) - >::type * = 0 - #endif - ) + void insert_unique(ordered_unique_range_t, InIt first, InIt last) { - const bool value = boost::container::container_detail:: - has_member_function_callable_with_merge_unique<container_type, iterator, iterator, value_compare>::value; - (flat_tree_merge_unique)(this->m_data.m_seq, first, last, this->priv_value_comp(), container_detail::bool_<value>()); + const bool value = boost::container::dtl:: + has_member_function_callable_with_merge_unique<container_type, InIt, InIt, value_compare>::value; + (flat_tree_merge_unique)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_<value>()); } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -878,7 +921,7 @@ class flat_tree std::pair<iterator, bool> emplace_unique(BOOST_FWD_REF(Args)... args) { typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); value_destructor<stored_allocator_type, value_type> d(a, val); @@ -890,7 +933,7 @@ class flat_tree { //hint checked in insert_unique typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); value_destructor<stored_allocator_type, value_type> d(a, val); @@ -901,7 +944,7 @@ class flat_tree iterator emplace_equal(BOOST_FWD_REF(Args)... args) { typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); value_destructor<stored_allocator_type, value_type> d(a, val); @@ -913,7 +956,7 @@ class flat_tree { //hint checked in insert_equal typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v)); + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); value_destructor<stored_allocator_type, value_type> d(a, val); @@ -950,7 +993,7 @@ class flat_tree std::pair<iterator, bool> emplace_unique(BOOST_MOVE_UREF##N)\ {\ typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));\ + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor<stored_allocator_type, value_type> d(a, val);\ @@ -961,7 +1004,7 @@ class flat_tree iterator emplace_hint_unique(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));\ + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor<stored_allocator_type, value_type> d(a, val);\ @@ -972,7 +1015,7 @@ class flat_tree iterator emplace_equal(BOOST_MOVE_UREF##N)\ {\ typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));\ + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor<stored_allocator_type, value_type> d(a, val);\ @@ -983,7 +1026,7 @@ class flat_tree iterator emplace_hint_equal(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ typename aligned_storage <sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(&v));\ + value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor<stored_allocator_type, value_type> d(a, val);\ @@ -1069,30 +1112,30 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_nth<container_type, size_type>::value; - return flat_tree_nth<iterator>(this->m_data.m_seq, n, container_detail::bool_<value>()); + return flat_tree_nth<iterator>(this->m_data.m_seq, n, dtl::bool_<value>()); } BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_nth<container_type, size_type>::value; - return flat_tree_nth<const_iterator>(this->m_data.m_seq, n, container_detail::bool_<value>()); + return flat_tree_nth<const_iterator>(this->m_data.m_seq, n, dtl::bool_<value>()); } BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_index_of<container_type, iterator>::value; - return flat_tree_index_of(this->m_data.m_seq, p, container_detail::bool_<value>()); + return flat_tree_index_of(this->m_data.m_seq, p, dtl::bool_<value>()); } BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_index_of<container_type, const_iterator>::value; - return flat_tree_index_of(this->m_data.m_seq, p, container_detail::bool_<value>()); + return flat_tree_index_of(this->m_data.m_seq, p, dtl::bool_<value>()); } // set operations: @@ -1141,26 +1184,26 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE void merge_unique(flat_tree& source) { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_merge_unique<container_type, iterator, iterator, value_compare>::value; (flat_tree_merge_unique) ( this->m_data.m_seq , boost::make_move_iterator(source.m_data.m_seq.begin()) , boost::make_move_iterator(source.m_data.m_seq.end()) , this->priv_value_comp() - , container_detail::bool_<value>()); + , dtl::bool_<value>()); } BOOST_CONTAINER_FORCEINLINE void merge_equal(flat_tree& source) { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_merge<container_type, iterator, iterator, value_compare>::value; (flat_tree_merge_equal) ( this->m_data.m_seq , boost::make_move_iterator(source.m_data.m_seq.begin()) , boost::make_move_iterator(source.m_data.m_seq.end()) , this->priv_value_comp() - , container_detail::bool_<value>()); + , dtl::bool_<value>()); } BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) @@ -1189,16 +1232,16 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE size_type capacity() const { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_capacity<container_type>::value; - return (flat_tree_capacity)(this->m_data.m_seq, container_detail::bool_<value>()); + return (flat_tree_capacity)(this->m_data.m_seq, dtl::bool_<value>()); } BOOST_CONTAINER_FORCEINLINE void reserve(size_type cnt) { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_reserve<container_type, size_type>::value; - (flat_tree_reserve)(this->m_data.m_seq, cnt, container_detail::bool_<value>()); + (flat_tree_reserve)(this->m_data.m_seq, cnt, dtl::bool_<value>()); } BOOST_CONTAINER_FORCEINLINE container_type extract_sequence() @@ -1214,13 +1257,13 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE void adopt_sequence_equal(BOOST_RV_REF(container_type) seq) { (flat_tree_adopt_sequence_equal)( m_data.m_seq, boost::move(seq), this->priv_value_comp() - , container_detail::bool_<is_contiguous_container<container_type>::value>()); + , dtl::bool_<is_contiguous_container<container_type>::value>()); } BOOST_CONTAINER_FORCEINLINE void adopt_sequence_unique(BOOST_RV_REF(container_type) seq) { (flat_tree_adopt_sequence_unique)(m_data.m_seq, boost::move(seq), this->priv_value_comp() - , container_detail::bool_<is_contiguous_container<container_type>::value>()); + , dtl::bool_<is_contiguous_container<container_type>::value>()); } void adopt_sequence_equal(ordered_range_t, BOOST_RV_REF(container_type) seq) @@ -1270,14 +1313,10 @@ class flat_tree //for the constructor //Call end() every iteration as reallocation might have invalidated iterators if(unique_insertion){ - for ( ; first != last; ++first){ - this->insert_unique(this->cend(), *first); - } + this->insert_unique(first, last); } else{ - for ( ; first != last; ++first){ - this->insert_equal(this->cend(), *first); - } + this->insert_equal (first, last); } } @@ -1474,30 +1513,9 @@ class flat_tree } return std::pair<RanIt, RanIt>(lb, ub); } - - template<class InIt> - void priv_insert_equal_loop(InIt first, InIt last) - { - for ( ; first != last; ++first){ - this->insert_equal(*first); - } - } - - template<class InIt> - void priv_insert_equal_loop_ordered(InIt first, InIt last) - { - const_iterator pos(this->cend()); - for ( ; first != last; ++first){ - //If ordered, then try hint version - //to achieve constant-time complexity per insertion - //in some cases - pos = this->insert_equal(pos, *first); - ++pos; - } - } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { @@ -1505,9 +1523,9 @@ class flat_tree //!specialization for optimizations template <class T, class KeyOfValue, class Compare, class AllocatorOrContainer> -struct has_trivial_destructor_after_move<boost::container::container_detail::flat_tree<T, KeyOfValue, Compare, AllocatorOrContainer> > +struct has_trivial_destructor_after_move<boost::container::dtl::flat_tree<T, KeyOfValue, Compare, AllocatorOrContainer> > { - typedef typename boost::container::container_detail::select_container_type<T, AllocatorOrContainer>::type container_type; + typedef typename boost::container::dtl::select_container_type<T, AllocatorOrContainer>::type container_type; typedef typename container_type::allocator_type allocator_t; typedef typename ::boost::container::allocator_traits<allocator_t>::pointer pointer; static const bool value = ::boost::has_trivial_destructor_after_move<allocator_t>::value && diff --git a/boost/container/detail/is_container.hpp b/boost/container/detail/is_container.hpp index 6052f045e0..feab702e9e 100644 --- a/boost/container/detail/is_container.hpp +++ b/boost/container/detail/is_container.hpp @@ -36,7 +36,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template <class Container> struct is_container @@ -48,7 +48,7 @@ struct is_container has_member_function_callable_with_empty<const Container>::value; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/is_contiguous_container.hpp b/boost/container/detail/is_contiguous_container.hpp index af98c7f18b..528aeee133 100644 --- a/boost/container/detail/is_contiguous_container.hpp +++ b/boost/container/detail/is_contiguous_container.hpp @@ -28,7 +28,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template <class Container> struct is_contiguous_container @@ -40,7 +40,7 @@ struct is_contiguous_container has_member_function_callable_with_data<const Container>::value; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/is_sorted.hpp b/boost/container/detail/is_sorted.hpp index b8c223bb7b..315bab54d7 100644 --- a/boost/container/detail/is_sorted.hpp +++ b/boost/container/detail/is_sorted.hpp @@ -20,7 +20,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template <class ForwardIterator, class Pred> bool is_sorted (ForwardIterator first, ForwardIterator last, Pred pred) @@ -50,7 +50,7 @@ bool is_sorted_and_unique (ForwardIterator first, ForwardIterator last, Pred pre return true; } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/iterator.hpp b/boost/container/detail/iterator.hpp index 8538acc161..2ceaf26001 100644 --- a/boost/container/detail/iterator.hpp +++ b/boost/container/detail/iterator.hpp @@ -22,6 +22,7 @@ #endif #include <boost/intrusive/detail/iterator.hpp> +#include <boost/move/utility_core.hpp> namespace boost { namespace container { @@ -34,6 +35,35 @@ using ::boost::intrusive::iterator_enable_if_tag; using ::boost::intrusive::iterator_disable_if_tag; using ::boost::intrusive::iterator_arrow_result; +template <class Container> +class back_emplacer +{ + private: + Container& container; + + public: + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + back_emplacer(Container& x) + : container(x) + {} + + template<class U> + back_emplacer& operator=(BOOST_FWD_REF(U) value) + { + container.emplace_back(boost::forward<U>(value)); + return *this; + } + back_emplacer& operator*() { return *this; } + back_emplacer& operator++() { return *this; } + back_emplacer& operator++(int){ return *this; } +}; + + } //namespace container { } //namespace boost { diff --git a/boost/container/detail/iterator_to_raw_pointer.hpp b/boost/container/detail/iterator_to_raw_pointer.hpp index 8c7c880035..49f1d43bab 100644 --- a/boost/container/detail/iterator_to_raw_pointer.hpp +++ b/boost/container/detail/iterator_to_raw_pointer.hpp @@ -22,11 +22,11 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { using ::boost::movelib::iterator_to_raw_pointer; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/iterators.hpp b/boost/container/detail/iterators.hpp index 11ffaae65e..7ccdac911c 100644 --- a/boost/container/detail/iterators.hpp +++ b/boost/container/detail/iterators.hpp @@ -612,7 +612,7 @@ class emplace_iterator template<class ...Args> struct emplace_functor { - typedef typename container_detail::build_number_seq<sizeof...(Args)>::type index_tuple_t; + typedef typename dtl::build_number_seq<sizeof...(Args)>::type index_tuple_t; emplace_functor(BOOST_FWD_REF(Args)... args) : args_(args...) @@ -628,21 +628,21 @@ struct emplace_functor private: template<class Allocator, class T, std::size_t ...IdxPack> - BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple<IdxPack...>&) + BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const dtl::index_tuple<IdxPack...>&) { allocator_traits<Allocator>::construct - (a, ptr, ::boost::forward<Args>(container_detail::get<IdxPack>(args_))...); + (a, ptr, ::boost::forward<Args>(dtl::get<IdxPack>(args_))...); } template<class DestIt, std::size_t ...IdxPack> - BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const container_detail::index_tuple<IdxPack...>&) + BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const dtl::index_tuple<IdxPack...>&) { typedef typename boost::container::iterator_traits<DestIt>::value_type value_type; - value_type && tmp= value_type(::boost::forward<Args>(container_detail::get<IdxPack>(args_))...); + value_type && tmp= value_type(::boost::forward<Args>(dtl::get<IdxPack>(args_))...); *dest = ::boost::move(tmp); } - container_detail::tuple<Args&...> args_; + dtl::tuple<Args&...> args_; }; template<class ...Args> @@ -672,7 +672,7 @@ struct emplace_functor##N\ void operator()(DestIt dest)\ {\ typedef typename boost::container::iterator_traits<DestIt>::value_type value_type;\ - BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), container_detail::value_init<value_type> tmp) ;\ + BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), dtl::value_init<value_type> tmp) ;\ *dest = ::boost::move(const_cast<value_type &>(BOOST_MOVE_IF(N, tmp, tmp.get())));\ }\ \ @@ -692,7 +692,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE) #endif -namespace container_detail { +namespace dtl { template<class T> struct has_iterator_category @@ -863,7 +863,7 @@ class iterator_from_iiterator IIterator m_iit; }; -} //namespace container_detail { +} //namespace dtl { using ::boost::intrusive::reverse_iterator; diff --git a/boost/container/detail/math_functions.hpp b/boost/container/detail/math_functions.hpp index e499f633ec..f1519315a3 100644 --- a/boost/container/detail/math_functions.hpp +++ b/boost/container/detail/math_functions.hpp @@ -32,7 +32,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { // Greatest common divisor and least common multiple @@ -114,7 +114,7 @@ inline std::size_t floor_log2 (std::size_t x) return log2; } -} // namespace container_detail +} // namespace dtl } // namespace container } // namespace boost diff --git a/boost/container/detail/min_max.hpp b/boost/container/detail/min_max.hpp index 7486db7d05..35cf06617d 100644 --- a/boost/container/detail/min_max.hpp +++ b/boost/container/detail/min_max.hpp @@ -20,7 +20,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class T> const T &max_value(const T &a, const T &b) @@ -30,7 +30,7 @@ template<class T> const T &min_value(const T &a, const T &b) { return a < b ? a : b; } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/mpl.hpp b/boost/container/detail/mpl.hpp index 82fcc7036d..4bb3cc7d22 100644 --- a/boost/container/detail/mpl.hpp +++ b/boost/container/detail/mpl.hpp @@ -30,7 +30,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { using boost::move_detail::integral_constant; using boost::move_detail::true_type; @@ -76,7 +76,7 @@ struct select1st { return const_cast<type&>(x.first); } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/multiallocation_chain.hpp b/boost/container/detail/multiallocation_chain.hpp index bce1b8651f..c10f809bb4 100644 --- a/boost/container/detail/multiallocation_chain.hpp +++ b/boost/container/detail/multiallocation_chain.hpp @@ -35,7 +35,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class VoidPointer> class basic_multiallocation_chain @@ -53,7 +53,7 @@ class basic_multiallocation_chain typedef bi::slist< node , bi::linear<true> , bi::cache_last<true> - , bi::size_type<typename boost::container::container_detail::make_unsigned<difference_type>::type> + , bi::size_type<typename boost::container::dtl::make_unsigned<difference_type>::type> > slist_impl_t; slist_impl_t slist_impl_; @@ -182,7 +182,7 @@ class basic_multiallocation_chain template<class T> struct cast_functor { - typedef typename container_detail::add_reference<T>::type result_type; + typedef typename dtl::add_reference<T>::type result_type; template<class U> result_type operator()(U &ptr) const { return *static_cast<T*>(static_cast<void*>(&ptr)); } @@ -211,7 +211,7 @@ class transform_multiallocation_chain public: typedef transform_iterator < typename MultiallocationChain::iterator - , container_detail::cast_functor <T> > iterator; + , dtl::cast_functor <T> > iterator; typedef typename MultiallocationChain::size_type size_type; transform_multiallocation_chain() @@ -289,7 +289,7 @@ class transform_multiallocation_chain }}} -// namespace container_detail { +// namespace dtl { // namespace container { // namespace boost { diff --git a/boost/container/detail/mutex.hpp b/boost/container/detail/mutex.hpp index 9743614c23..56e72a81d0 100644 --- a/boost/container/detail/mutex.hpp +++ b/boost/container/detail/mutex.hpp @@ -171,7 +171,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { #if BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_NONE class null_mutex @@ -268,7 +268,7 @@ class scoped_lock Mutex &m_; }; -} // namespace container_detail +} // namespace dtl } // namespace container } // namespace boost diff --git a/boost/container/detail/next_capacity.hpp b/boost/container/detail/next_capacity.hpp index 3bc98a3c91..7e6554ded0 100644 --- a/boost/container/detail/next_capacity.hpp +++ b/boost/container/detail/next_capacity.hpp @@ -23,52 +23,54 @@ // container/detail #include <boost/container/detail/min_max.hpp> +#include <boost/static_assert.hpp> + namespace boost { namespace container { -namespace container_detail { - -enum NextCapacityOption { NextCapacityDouble, NextCapacity60Percent }; - -template<class SizeType, NextCapacityOption Option> -struct next_capacity_calculator; +namespace dtl { -template<class SizeType> -struct next_capacity_calculator<SizeType, NextCapacityDouble> +template<unsigned Minimum, unsigned Numerator, unsigned Denominator> +struct grow_factor_ratio { - static SizeType get(const SizeType max_size - ,const SizeType capacity - ,const SizeType n) - { - const SizeType remaining = max_size - capacity; - if ( remaining < n ) - boost::container::throw_length_error("get_next_capacity, allocator's max_size reached"); - const SizeType additional = max_value(n, capacity); - return ( remaining < additional ) ? max_size : ( capacity + additional ); - } -}; + BOOST_STATIC_ASSERT(Numerator > Denominator); + BOOST_STATIC_ASSERT(Numerator < 100); + BOOST_STATIC_ASSERT(Denominator < 100); + BOOST_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator)); -template<class SizeType> -struct next_capacity_calculator<SizeType, NextCapacity60Percent> -{ - static SizeType get(const SizeType max_size - ,const SizeType capacity - ,const SizeType n) + template<class SizeType> + SizeType operator()(const SizeType cur_cap, const SizeType add_min_cap, const SizeType max_cap) const { - const SizeType remaining = max_size - capacity; - if ( remaining < n ) - boost::container::throw_length_error("get_next_capacity, allocator's max_size reached"); - const SizeType m3 = max_size/3; + const SizeType overflow_limit = ((SizeType)-1) / Numerator; - if (capacity < m3) - return capacity + max_value(3*(capacity+1)/5, n); + SizeType new_cap = 0; - if (capacity < m3*2) - return capacity + max_value((capacity+1)/2, n); - return max_size; + if(cur_cap <= overflow_limit){ + new_cap = cur_cap * Numerator / Denominator; + } + else if(Denominator == 1 || (SizeType(new_cap = cur_cap) / Denominator) > overflow_limit){ + new_cap = (SizeType)-1; + } + else{ + new_cap *= Numerator; + } + return max_value(SizeType(Minimum), max_value(cur_cap+add_min_cap, min_value(max_cap, new_cap))); } }; -} //namespace container_detail { +} //namespace dtl { + +struct growth_factor_50 + : dtl::grow_factor_ratio<0, 3, 2> +{}; + +struct growth_factor_60 + : dtl::grow_factor_ratio<0, 8, 5> +{}; + +struct growth_factor_100 + : dtl::grow_factor_ratio<0, 2, 1> +{}; + } //namespace container { } //namespace boost { diff --git a/boost/container/detail/node_alloc_holder.hpp b/boost/container/detail/node_alloc_holder.hpp index b6e602e884..ad7b713d6e 100644 --- a/boost/container/detail/node_alloc_holder.hpp +++ b/boost/container/detail/node_alloc_holder.hpp @@ -50,7 +50,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_compare) BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(predicate_type) @@ -61,14 +61,14 @@ struct node_alloc_holder //If the intrusive container is an associative container, obtain the predicate, which will //be of type node_compare<>. If not an associative container value_compare will be a "nat" type. typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT - ( boost::container::container_detail:: - , ICont, value_compare, container_detail::nat) intrusive_value_compare; + ( boost::container::dtl:: + , ICont, value_compare, dtl::nat) intrusive_value_compare; //In that case obtain the value predicate from the node predicate via predicate_type //if intrusive_value_compare is node_compare<>, nat otherwise typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT - ( boost::container::container_detail:: + ( boost::container::dtl:: , intrusive_value_compare - , predicate_type, container_detail::nat) value_compare; + , predicate_type, dtl::nat) value_compare; typedef allocator_traits<Allocator> allocator_traits_type; typedef typename allocator_traits_type::value_type value_type; @@ -77,14 +77,14 @@ struct node_alloc_holder typedef typename allocator_traits_type::template portable_rebind_alloc<Node>::type NodeAlloc; typedef allocator_traits<NodeAlloc> node_allocator_traits_type; - typedef container_detail::allocator_version_traits<NodeAlloc> node_allocator_version_traits_type; + typedef dtl::allocator_version_traits<NodeAlloc> node_allocator_version_traits_type; typedef Allocator ValAlloc; typedef typename node_allocator_traits_type::pointer NodePtr; - typedef container_detail::scoped_deallocator<NodeAlloc> Deallocator; + typedef dtl::scoped_deallocator<NodeAlloc> Deallocator; typedef typename node_allocator_traits_type::size_type size_type; typedef typename node_allocator_traits_type::difference_type difference_type; - typedef container_detail::integral_constant<unsigned, - boost::container::container_detail:: + typedef dtl::integral_constant<unsigned, + boost::container::dtl:: version<NodeAlloc>::value> alloc_version; typedef typename ICont::iterator icont_iterator; typedef typename ICont::const_iterator icont_citerator; @@ -134,15 +134,15 @@ struct node_alloc_holder void copy_assign_alloc(const node_alloc_holder &x) { - container_detail::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag; - container_detail::assign_alloc( static_cast<NodeAlloc &>(this->members_) + dtl::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag; + dtl::assign_alloc( static_cast<NodeAlloc &>(this->members_) , static_cast<const NodeAlloc &>(x.members_), flag); } void move_assign_alloc( node_alloc_holder &x) { - container_detail::bool_<allocator_traits_type::propagate_on_container_move_assignment::value> flag; - container_detail::move_alloc( static_cast<NodeAlloc &>(this->members_) + dtl::bool_<allocator_traits_type::propagate_on_container_move_assignment::value> flag; + dtl::move_alloc( static_cast<NodeAlloc &>(this->members_) , static_cast<NodeAlloc &>(x.members_), flag); } @@ -167,7 +167,7 @@ struct node_alloc_holder Deallocator node_deallocator(p, this->node_alloc()); allocator_traits<NodeAlloc>::construct ( this->node_alloc() - , container_detail::addressof(p->m_data), boost::forward<Args>(args)...); + , dtl::addressof(p->m_data), boost::forward<Args>(args)...); node_deallocator.release(); //This does not throw typedef typename Node::hook_type hook_type; @@ -185,7 +185,7 @@ struct node_alloc_holder Deallocator node_deallocator(p, this->node_alloc());\ allocator_traits<NodeAlloc>::construct\ ( this->node_alloc()\ - , container_detail::addressof(p->m_data)\ + , dtl::addressof(p->m_data)\ BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ node_deallocator.release();\ typedef typename Node::hook_type hook_type;\ @@ -203,7 +203,7 @@ struct node_alloc_holder { NodePtr p = this->allocate_one(); Deallocator node_deallocator(p, this->node_alloc()); - ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it); + ::boost::container::construct_in_place(this->node_alloc(), dtl::addressof(p->m_data), it); node_deallocator.release(); //This does not throw typedef typename Node::hook_type hook_type; @@ -218,12 +218,12 @@ struct node_alloc_holder NodeAlloc &na = this->node_alloc(); Deallocator node_deallocator(p, this->node_alloc()); node_allocator_traits_type::construct - (na, container_detail::addressof(p->m_data.first), boost::forward<KeyConvertible>(key)); + (na, dtl::addressof(p->m_data.first), boost::forward<KeyConvertible>(key)); BOOST_TRY{ - node_allocator_traits_type::construct(na, container_detail::addressof(p->m_data.second)); + node_allocator_traits_type::construct(na, dtl::addressof(p->m_data.second)); } BOOST_CATCH(...){ - node_allocator_traits_type::destroy(na, container_detail::addressof(p->m_data.first)); + node_allocator_traits_type::destroy(na, dtl::addressof(p->m_data.first)); BOOST_RETHROW; } BOOST_CATCH_END @@ -243,8 +243,8 @@ struct node_alloc_holder void swap(node_alloc_holder &x) { this->icont().swap(x.icont()); - container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag; - container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag); + dtl::bool_<allocator_traits_type::propagate_on_container_swap::value> flag; + dtl::swap_alloc(this->node_alloc(), x.node_alloc(), flag); } template<class FwdIterator, class Inserter> @@ -264,13 +264,13 @@ struct node_alloc_holder Node *p = 0; BOOST_TRY{ Deallocator node_deallocator(NodePtr(), nalloc); - container_detail::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0); + dtl::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0); while(n--){ p = boost::movelib::iterator_to_raw_pointer(itbeg); node_deallocator.set(p); ++itbeg; //This can throw - boost::container::construct_in_place(nalloc, container_detail::addressof(p->m_data), beg); + boost::container::construct_in_place(nalloc, dtl::addressof(p->m_data), beg); sdestructor.set(p); ++beg; //This does not throw @@ -410,7 +410,7 @@ struct node_alloc_holder { return this->members_.m_icont; } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/node_pool.hpp b/boost/container/detail/node_pool.hpp index 00e35dfa8d..e43956b643 100644 --- a/boost/container/detail/node_pool.hpp +++ b/boost/container/detail/node_pool.hpp @@ -32,7 +32,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { //!Pooled memory allocator using single segregated storage. Includes //!a reference count but the class does not delete itself, this is @@ -41,10 +41,10 @@ namespace container_detail { template< std::size_t NodeSize, std::size_t NodesPerBlock > class private_node_pool //Inherit from the implementation to avoid template bloat - : public boost::container::container_detail:: + : public boost::container::dtl:: private_node_pool_impl<fake_segment_manager> { - typedef boost::container::container_detail:: + typedef boost::container::dtl:: private_node_pool_impl<fake_segment_manager> base_t; //Non-copyable private_node_pool(const private_node_pool &); @@ -148,7 +148,7 @@ class shared_node_pool default_mutex mutex_; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/node_pool_impl.hpp b/boost/container/detail/node_pool_impl.hpp index 024bf306c5..97f555bc75 100644 --- a/boost/container/detail/node_pool_impl.hpp +++ b/boost/container/detail/node_pool_impl.hpp @@ -38,7 +38,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class SegmentManagerBase> class private_node_pool_impl @@ -366,7 +366,7 @@ class private_node_pool_impl }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/pair.hpp b/boost/container/detail/pair.hpp index 4755e569b2..6b00db1483 100644 --- a/boost/container/detail/pair.hpp +++ b/boost/container/detail/pair.hpp @@ -74,7 +74,7 @@ struct is_boost_tuple< boost::tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, template<class Tuple> struct disable_if_boost_tuple - : boost::container::container_detail::disable_if< is_boost_tuple<Tuple> > + : boost::container::dtl::disable_if< is_boost_tuple<Tuple> > {}; template<class T> @@ -133,7 +133,7 @@ static piecewise_construct_t piecewise_construct = BOOST_CONTAINER_DOC1ST(unspec ///@cond -namespace container_detail { +namespace dtl { struct piecewise_construct_use { @@ -283,7 +283,7 @@ struct pair pair( piecewise_construct_t\ , BoostTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::boost::tuples::null_type)> p\ , BoostTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::boost::tuples::null_type)> q\ - , typename container_detail::enable_if_c\ + , typename dtl::enable_if_c\ < pair_impl::is_boost_tuple< BoostTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::boost::tuples::null_type)> >::value &&\ !(pair_impl::is_tuple_null<BOOST_MOVE_LAST_TARG##N>::value || pair_impl::is_tuple_null<BOOST_MOVE_LAST_TARGQ##M>::value) \ >::type* = 0\ @@ -381,10 +381,10 @@ struct pair } template <class D, class S> - typename ::boost::container::container_detail::disable_if_or + typename ::boost::container::dtl::disable_if_or < pair & - , ::boost::container::container_detail::is_same<T1, D> - , ::boost::container::container_detail::is_same<T2, S> + , ::boost::container::dtl::is_same<T1, D> + , ::boost::container::dtl::is_same<T2, S> >::type operator=(const pair<D, S>&p) { @@ -394,10 +394,10 @@ struct pair } template <class D, class S> - typename ::boost::container::container_detail::disable_if_or + typename ::boost::container::dtl::disable_if_or < pair & - , ::boost::container::container_detail::is_same<T1, D> - , ::boost::container::container_detail::is_same<T2, S> + , ::boost::container::dtl::is_same<T1, D> + , ::boost::container::dtl::is_same<T2, S> >::type operator=(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p) { @@ -478,13 +478,13 @@ template <class T1, class T2> inline void swap(pair<T1, T2>& x, pair<T1, T2>& y) { x.swap(y); } -} //namespace container_detail { +} //namespace dtl { } //namespace container { #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template<class T1, class T2> -struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> > +struct has_move_emulation_enabled< ::boost::container::dtl::pair<T1, T2> > { static const bool value = true; }; @@ -497,7 +497,7 @@ template<class T> struct is_class_or_union; template <class T1, class T2> -struct is_class_or_union< ::boost::container::container_detail::pair<T1, T2> > +struct is_class_or_union< ::boost::container::dtl::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { @@ -516,7 +516,7 @@ template<class T> struct is_union; template <class T1, class T2> -struct is_union< ::boost::container::container_detail::pair<T1, T2> > +struct is_union< ::boost::container::dtl::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { @@ -535,7 +535,7 @@ template<class T> struct is_class; template <class T1, class T2> -struct is_class< ::boost::container::container_detail::pair<T1, T2> > +struct is_class< ::boost::container::dtl::pair<T1, T2> > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { diff --git a/boost/container/detail/pool_common.hpp b/boost/container/detail/pool_common.hpp index 61d0612ed1..f42c1dd4d2 100644 --- a/boost/container/detail/pool_common.hpp +++ b/boost/container/detail/pool_common.hpp @@ -26,7 +26,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class VoidPointer> struct node_slist @@ -48,7 +48,7 @@ struct is_stateless_segment_manager static const bool value = false; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/pool_common_alloc.hpp b/boost/container/detail/pool_common_alloc.hpp index 3a3c80a78f..bfb82f5561 100644 --- a/boost/container/detail/pool_common_alloc.hpp +++ b/boost/container/detail/pool_common_alloc.hpp @@ -30,10 +30,10 @@ namespace boost{ namespace container{ -namespace container_detail{ +namespace dtl{ struct node_slist_helper - : public boost::container::container_detail::node_slist<void*> + : public boost::container::dtl::node_slist<void*> {}; struct fake_segment_manager @@ -41,7 +41,7 @@ struct fake_segment_manager typedef void * void_pointer; static const std::size_t PayloadPerAllocation = BOOST_CONTAINER_ALLOCATION_PAYLOAD; - typedef boost::container::container_detail:: + typedef boost::container::dtl:: basic_multiallocation_chain<void*> multiallocation_chain; static void deallocate(void_pointer p) { dlmalloc_free(p); } @@ -77,23 +77,23 @@ struct fake_segment_manager } //namespace boost{ } //namespace container{ -} //namespace container_detail{ +} //namespace dtl{ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class T> struct is_stateless_segment_manager; template<> struct is_stateless_segment_manager - <boost::container::container_detail::fake_segment_manager> + <boost::container::dtl::fake_segment_manager> { static const bool value = true; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/singleton.hpp b/boost/container/detail/singleton.hpp index 6fd6a54f30..7601c3ca8c 100644 --- a/boost/container/detail/singleton.hpp +++ b/boost/container/detail/singleton.hpp @@ -69,7 +69,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { // T must be: no-throw default constructible and no-throw destructible template <typename T> @@ -112,7 +112,7 @@ template <typename T> typename singleton_default<T>::object_creator singleton_default<T>::create_object; -} // namespace container_detail +} // namespace dtl } // namespace container } // namespace boost diff --git a/boost/container/detail/transform_iterator.hpp b/boost/container/detail/transform_iterator.hpp index ba64c7de79..ce81813ebb 100644 --- a/boost/container/detail/transform_iterator.hpp +++ b/boost/container/detail/transform_iterator.hpp @@ -63,7 +63,7 @@ class transform_iterator : public UnaryFunction , public boost::container::iterator < typename Iterator::iterator_category - , typename container_detail::remove_reference<typename UnaryFunction::result_type>::type + , typename dtl::remove_reference<typename UnaryFunction::result_type>::type , typename Iterator::difference_type , operator_arrow_proxy<typename UnaryFunction::result_type> , typename UnaryFunction::result_type> diff --git a/boost/container/detail/tree.hpp b/boost/container/detail/tree.hpp index 99baf3a257..8d41158490 100644 --- a/boost/container/detail/tree.hpp +++ b/boost/container/detail/tree.hpp @@ -61,7 +61,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { using boost::intrusive::tree_value_compare; @@ -71,38 +71,38 @@ struct intrusive_tree_hook; template<class VoidPointer, bool OptimizeSize> struct intrusive_tree_hook<VoidPointer, boost::container::red_black_tree, OptimizeSize> { - typedef typename container_detail::bi::make_set_base_hook - < container_detail::bi::void_pointer<VoidPointer> - , container_detail::bi::link_mode<container_detail::bi::normal_link> - , container_detail::bi::optimize_size<OptimizeSize> + typedef typename dtl::bi::make_set_base_hook + < dtl::bi::void_pointer<VoidPointer> + , dtl::bi::link_mode<dtl::bi::normal_link> + , dtl::bi::optimize_size<OptimizeSize> >::type type; }; template<class VoidPointer, bool OptimizeSize> struct intrusive_tree_hook<VoidPointer, boost::container::avl_tree, OptimizeSize> { - typedef typename container_detail::bi::make_avl_set_base_hook - < container_detail::bi::void_pointer<VoidPointer> - , container_detail::bi::link_mode<container_detail::bi::normal_link> - , container_detail::bi::optimize_size<OptimizeSize> + typedef typename dtl::bi::make_avl_set_base_hook + < dtl::bi::void_pointer<VoidPointer> + , dtl::bi::link_mode<dtl::bi::normal_link> + , dtl::bi::optimize_size<OptimizeSize> >::type type; }; template<class VoidPointer, bool OptimizeSize> struct intrusive_tree_hook<VoidPointer, boost::container::scapegoat_tree, OptimizeSize> { - typedef typename container_detail::bi::make_bs_set_base_hook - < container_detail::bi::void_pointer<VoidPointer> - , container_detail::bi::link_mode<container_detail::bi::normal_link> + typedef typename dtl::bi::make_bs_set_base_hook + < dtl::bi::void_pointer<VoidPointer> + , dtl::bi::link_mode<dtl::bi::normal_link> >::type type; }; template<class VoidPointer, bool OptimizeSize> struct intrusive_tree_hook<VoidPointer, boost::container::splay_tree, OptimizeSize> { - typedef typename container_detail::bi::make_bs_set_base_hook - < container_detail::bi::void_pointer<VoidPointer> - , container_detail::bi::link_mode<container_detail::bi::normal_link> + typedef typename dtl::bi::make_bs_set_base_hook + < dtl::bi::void_pointer<VoidPointer> + , dtl::bi::link_mode<dtl::bi::normal_link> >::type type; }; @@ -222,9 +222,9 @@ class push_back_functor { this->icont_.push_back(n); } }; -}//namespace container_detail { +}//namespace dtl { -namespace container_detail { +namespace dtl { template< class NodeType, class NodeCompareType , class SizeType, class HookType @@ -235,12 +235,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType> struct intrusive_tree_dispatch <NodeType, NodeCompareType, SizeType, HookType, boost::container::red_black_tree> { - typedef typename container_detail::bi::make_rbtree + typedef typename dtl::bi::make_rbtree <NodeType - ,container_detail::bi::compare<NodeCompareType> - ,container_detail::bi::base_hook<HookType> - ,container_detail::bi::constant_time_size<true> - ,container_detail::bi::size_type<SizeType> + ,dtl::bi::compare<NodeCompareType> + ,dtl::bi::base_hook<HookType> + ,dtl::bi::constant_time_size<true> + ,dtl::bi::size_type<SizeType> >::type type; }; @@ -248,12 +248,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType> struct intrusive_tree_dispatch <NodeType, NodeCompareType, SizeType, HookType, boost::container::avl_tree> { - typedef typename container_detail::bi::make_avltree + typedef typename dtl::bi::make_avltree <NodeType - ,container_detail::bi::compare<NodeCompareType> - ,container_detail::bi::base_hook<HookType> - ,container_detail::bi::constant_time_size<true> - ,container_detail::bi::size_type<SizeType> + ,dtl::bi::compare<NodeCompareType> + ,dtl::bi::base_hook<HookType> + ,dtl::bi::constant_time_size<true> + ,dtl::bi::size_type<SizeType> >::type type; }; @@ -261,12 +261,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType> struct intrusive_tree_dispatch <NodeType, NodeCompareType, SizeType, HookType, boost::container::scapegoat_tree> { - typedef typename container_detail::bi::make_sgtree + typedef typename dtl::bi::make_sgtree <NodeType - ,container_detail::bi::compare<NodeCompareType> - ,container_detail::bi::base_hook<HookType> - ,container_detail::bi::floating_point<true> - ,container_detail::bi::size_type<SizeType> + ,dtl::bi::compare<NodeCompareType> + ,dtl::bi::base_hook<HookType> + ,dtl::bi::floating_point<true> + ,dtl::bi::size_type<SizeType> >::type type; }; @@ -274,12 +274,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType> struct intrusive_tree_dispatch <NodeType, NodeCompareType, SizeType, HookType, boost::container::splay_tree> { - typedef typename container_detail::bi::make_splaytree + typedef typename dtl::bi::make_splaytree <NodeType - ,container_detail::bi::compare<NodeCompareType> - ,container_detail::bi::base_hook<HookType> - ,container_detail::bi::constant_time_size<true> - ,container_detail::bi::size_type<SizeType> + ,dtl::bi::compare<NodeCompareType> + ,dtl::bi::base_hook<HookType> + ,dtl::bi::constant_time_size<true> + ,dtl::bi::size_type<SizeType> >::type type; }; @@ -293,7 +293,7 @@ struct intrusive_tree_type allocator_traits<Allocator>::void_pointer void_pointer; typedef typename boost::container:: allocator_traits<Allocator>::size_type size_type; - typedef typename container_detail::tree_node + typedef typename dtl::tree_node < value_type, void_pointer , tree_type_value, OptimizeSize> node_t; typedef value_to_node_compare @@ -340,9 +340,9 @@ struct intrusive_tree_proxy<tree_type_value, true> { c.rebalance(); } }; -} //namespace container_detail { +} //namespace dtl { -namespace container_detail { +namespace dtl { //This functor will be used with Intrusive clone functions to obtain //already allocated nodes from a intrusive container instead of @@ -429,25 +429,40 @@ struct key_node_compare { return this->key_comp()(key_of_value()(nonkey1.get_data()), key_of_value()(nonkey2.get_data())); } }; -template <class T, class KeyOfValue, - class Compare, class Allocator, - class Options = tree_assoc_defaults> +template<class Options> +struct get_tree_opt +{ + typedef Options type; +}; + +template<> +struct get_tree_opt<void> +{ + typedef tree_assoc_defaults type; +}; + +template <class T, class KeyOfValue, class Compare, class Allocator, class Options> class tree - : public container_detail::node_alloc_holder + : public dtl::node_alloc_holder < Allocator - , typename container_detail::intrusive_tree_type + , typename dtl::intrusive_tree_type < Allocator, tree_value_compare <typename allocator_traits<Allocator>::pointer, Compare, KeyOfValue> - , Options::tree_type, Options::optimize_size>::type + , get_tree_opt<Options>::type::tree_type + , get_tree_opt<Options>::type::optimize_size + >::type > { typedef tree_value_compare < typename allocator_traits<Allocator>::pointer , Compare, KeyOfValue> ValComp; - typedef typename container_detail::intrusive_tree_type - < Allocator, ValComp, Options::tree_type - , Options::optimize_size>::type Icont; - typedef container_detail::node_alloc_holder + typedef typename get_tree_opt<Options>::type options_type; + typedef typename dtl::intrusive_tree_type + < Allocator, ValComp + , options_type::tree_type + , options_type::optimize_size + >::type Icont; + typedef dtl::node_alloc_holder <Allocator, Icont> AllocHolder; typedef typename AllocHolder::NodePtr NodePtr; typedef tree < T, KeyOfValue @@ -459,9 +474,9 @@ class tree typedef typename AllocHolder::Node Node; typedef typename Icont::iterator iiterator; typedef typename Icont::const_iterator iconst_iterator; - typedef container_detail::allocator_destroyer<NodeAlloc> Destroyer; + typedef dtl::allocator_destroyer<NodeAlloc> Destroyer; typedef typename AllocHolder::alloc_version alloc_version; - typedef intrusive_tree_proxy<Options::tree_type> intrusive_tree_proxy_t; + typedef intrusive_tree_proxy<options_type::tree_type> intrusive_tree_proxy_t; BOOST_COPYABLE_AND_MOVABLE(tree) @@ -484,9 +499,9 @@ class tree allocator_traits<Allocator>::size_type size_type; typedef typename boost::container:: allocator_traits<Allocator>::difference_type difference_type; - typedef container_detail::iterator_from_iiterator + typedef dtl::iterator_from_iiterator <iiterator, false> iterator; - typedef container_detail::iterator_from_iiterator + typedef dtl::iterator_from_iiterator <iiterator, true > const_iterator; typedef boost::container::reverse_iterator <iterator> reverse_iterator; @@ -590,10 +605,10 @@ class tree template <class InputIterator> void tree_construct_non_unique(InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_or + , typename dtl::enable_if_or < void - , container_detail::is_same<alloc_version, version_1> - , container_detail::is_input_iterator<InputIterator> + , dtl::is_same<alloc_version, version_1> + , dtl::is_input_iterator<InputIterator> >::type * = 0 #endif ) @@ -610,10 +625,10 @@ class tree template <class InputIterator> void tree_construct_non_unique(InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::disable_if_or + , typename dtl::disable_if_or < void - , container_detail::is_same<alloc_version, version_1> - , container_detail::is_input_iterator<InputIterator> + , dtl::is_same<alloc_version, version_1> + , dtl::is_input_iterator<InputIterator> >::type * = 0 #endif ) @@ -627,10 +642,10 @@ class tree template <class InputIterator> void tree_construct( ordered_range_t, InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::disable_if_or + , typename dtl::disable_if_or < void - , container_detail::is_same<alloc_version, version_1> - , container_detail::is_input_iterator<InputIterator> + , dtl::is_same<alloc_version, version_1> + , dtl::is_input_iterator<InputIterator> >::type * = 0 #endif ) @@ -638,17 +653,17 @@ class tree //Optimized allocation and construction this->allocate_many_and_construct ( first, boost::container::iterator_distance(first, last) - , container_detail::push_back_functor<Node, Icont>(this->icont())); + , dtl::push_back_functor<Node, Icont>(this->icont())); //AllocHolder clears in case of exception } template <class InputIterator> void tree_construct( ordered_range_t, InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_or + , typename dtl::enable_if_or < void - , container_detail::is_same<alloc_version, version_1> - , container_detail::is_input_iterator<InputIterator> + , dtl::is_same<alloc_version, version_1> + , dtl::is_input_iterator<InputIterator> >::type * = 0 #endif ) @@ -668,7 +683,7 @@ class tree } BOOST_CONTAINER_FORCEINLINE tree(BOOST_RV_REF(tree) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x), x.value_comp()) {} @@ -701,7 +716,7 @@ class tree if (&x != this){ NodeAlloc &this_alloc = this->get_stored_allocator(); const NodeAlloc &x_alloc = x.get_stored_allocator(); - container_detail::bool_<allocator_traits<NodeAlloc>:: + dtl::bool_<allocator_traits<NodeAlloc>:: propagate_on_container_copy_assignment::value> flag; if(flag && this_alloc != x_alloc){ this->clear(); @@ -730,7 +745,7 @@ class tree tree& operator=(BOOST_RV_REF(tree) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable<Compare>::value) + boost::container::dtl::is_nothrow_move_assignable<Compare>::value) { BOOST_ASSERT(this != &x); NodeAlloc &this_alloc = this->node_alloc(); @@ -856,7 +871,7 @@ class tree BOOST_CONTAINER_FORCEINLINE void swap(ThisType& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable<Compare>::value ) + && boost::container::dtl::is_nothrow_swappable<Compare>::value ) { AllocHolder::swap(x); } public: @@ -1315,7 +1330,7 @@ class tree { x.swap(y); } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { template <class T> @@ -1326,7 +1341,7 @@ struct has_trivial_destructor_after_move; template <class T, class KeyOfValue, class Compare, class Allocator, class Options> struct has_trivial_destructor_after_move < - ::boost::container::container_detail::tree + ::boost::container::dtl::tree <T, KeyOfValue, Compare, Allocator, Options> > { diff --git a/boost/container/detail/type_traits.hpp b/boost/container/detail/type_traits.hpp index e1453a6594..686cc409b7 100644 --- a/boost/container/detail/type_traits.hpp +++ b/boost/container/detail/type_traits.hpp @@ -28,7 +28,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { using ::boost::move_detail::enable_if; using ::boost::move_detail::enable_if_and; @@ -63,7 +63,7 @@ using ::boost::move_detail::aligned_storage; using ::boost::move_detail::nat; using ::boost::move_detail::max_align_t; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/value_functors.hpp b/boost/container/detail/value_functors.hpp new file mode 100644 index 0000000000..a2c494c5e7 --- /dev/null +++ b/boost/container/detail/value_functors.hpp @@ -0,0 +1,36 @@ +#ifndef BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP +#define BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP +/////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +//Functors for member algorithm defaults +template<class ValueType> +struct value_less +{ + bool operator()(const ValueType &a, const ValueType &b) const + { return a < b; } +}; + +template<class ValueType> +struct value_equal +{ + bool operator()(const ValueType &a, const ValueType &b) const + { return a == b; } +}; + +#endif //BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP diff --git a/boost/container/detail/value_init.hpp b/boost/container/detail/value_init.hpp index faba70ee14..35b0aa11d3 100644 --- a/boost/container/detail/value_init.hpp +++ b/boost/container/detail/value_init.hpp @@ -26,7 +26,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<class T> struct value_init @@ -42,7 +42,7 @@ struct value_init T m_t; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/variadic_templates_tools.hpp b/boost/container/detail/variadic_templates_tools.hpp index e9fa9cd15a..1e6f3df742 100644 --- a/boost/container/detail/variadic_templates_tools.hpp +++ b/boost/container/detail/variadic_templates_tools.hpp @@ -28,7 +28,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template<typename... Values> class tuple; @@ -156,7 +156,7 @@ struct build_number_seq template<> struct build_number_seq<0> : index_tuple<>{}; template<> struct build_number_seq<1> : index_tuple<0>{}; -}}} //namespace boost { namespace container { namespace container_detail { +}}} //namespace boost { namespace container { namespace dtl { #include <boost/container/detail/config_end.hpp> diff --git a/boost/container/detail/version_type.hpp b/boost/container/detail/version_type.hpp index a20b3eedaa..c2531ccc31 100644 --- a/boost/container/detail/version_type.hpp +++ b/boost/container/detail/version_type.hpp @@ -32,11 +32,11 @@ namespace boost{ namespace container { -namespace container_detail { +namespace dtl { template <class T, unsigned V> struct version_type - : public container_detail::integral_constant<unsigned, V> + : public dtl::integral_constant<unsigned, V> { typedef T type; @@ -46,7 +46,7 @@ struct version_type namespace impl{ template <class T, - bool = container_detail::is_convertible<version_type<T, 0>, typename T::version>::value> + bool = dtl::is_convertible<version_type<T, 0>, typename T::version>::value> struct extract_version { static const unsigned value = 1; @@ -86,7 +86,7 @@ struct version<T, true> template <class T> struct version - : public container_detail::integral_constant<unsigned, impl::version<T>::value> + : public dtl::integral_constant<unsigned, impl::version<T>::value> {}; template<class T, unsigned N> @@ -96,11 +96,11 @@ struct is_version is_same< typename version<T>::type, integral_constant<unsigned, N> >::value; }; -} //namespace container_detail { +} //namespace dtl { -typedef container_detail::integral_constant<unsigned, 0> version_0; -typedef container_detail::integral_constant<unsigned, 1> version_1; -typedef container_detail::integral_constant<unsigned, 2> version_2; +typedef dtl::integral_constant<unsigned, 0> version_0; +typedef dtl::integral_constant<unsigned, 1> version_1; +typedef dtl::integral_constant<unsigned, 2> version_2; } //namespace container { } //namespace boost{ |