diff options
Diffstat (limited to 'boost/multi_index/detail/rnd_index_node.hpp')
-rw-r--r-- | boost/multi_index/detail/rnd_index_node.hpp | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/boost/multi_index/detail/rnd_index_node.hpp b/boost/multi_index/detail/rnd_index_node.hpp index 72d93846a0..782fdd8067 100644 --- a/boost/multi_index/detail/rnd_index_node.hpp +++ b/boost/multi_index/detail/rnd_index_node.hpp @@ -15,12 +15,11 @@ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <algorithm> -#include <boost/detail/allocator_utilities.hpp> #include <boost/integer/common_factor_rt.hpp> +#include <boost/multi_index/detail/allocator_traits.hpp> #include <boost/multi_index/detail/raw_ptr.hpp> #include <cstddef> #include <functional> -#include <memory> namespace boost{ @@ -31,28 +30,19 @@ namespace detail{ template<typename Allocator> struct random_access_index_node_impl { - typedef typename - boost::detail::allocator::rebind_to< + typedef typename rebind_alloc_for< Allocator,random_access_index_node_impl - >::type node_allocator; -#ifdef BOOST_NO_CXX11_ALLOCATOR - typedef typename node_allocator::pointer pointer; - typedef typename node_allocator::const_pointer const_pointer; -#else - typedef std::allocator_traits<node_allocator> node_traits; - typedef typename node_traits::pointer pointer; - typedef typename node_traits::const_pointer const_pointer; -#endif - typedef typename - boost::detail::allocator::rebind_to< + >::type node_allocator; + typedef allocator_traits<node_allocator> node_alloc_traits; + typedef typename node_alloc_traits::pointer pointer; + typedef typename node_alloc_traits::const_pointer const_pointer; + typedef typename node_alloc_traits::difference_type difference_type; + typedef typename rebind_alloc_for< Allocator,pointer - >::type ptr_allocator; -#ifdef BOOST_NO_CXX11_ALLOCATOR - typedef typename ptr_allocator::pointer ptr_pointer; -#else - typedef std::allocator_traits<ptr_allocator> ptr_traits; - typedef typename ptr_traits::pointer ptr_pointer; -#endif + >::type ptr_allocator; + typedef allocator_traits<ptr_allocator> ptr_alloc_traits; + typedef typename ptr_alloc_traits::pointer ptr_pointer; + ptr_pointer& up(){return up_;} ptr_pointer up()const{return up_;} @@ -68,14 +58,14 @@ struct random_access_index_node_impl x=*(x->up()-1); } - static void advance(pointer& x,std::ptrdiff_t n) + static void advance(pointer& x,difference_type n) { x=*(x->up()+n); } - static std::ptrdiff_t distance(pointer x,pointer y) + static difference_type distance(pointer x,pointer y) { - return y->up()-x->up(); + return static_cast<difference_type>(y->up()-x->up()); } /* algorithmic stuff */ @@ -186,14 +176,14 @@ private: template<typename Super> struct random_access_index_node_trampoline: random_access_index_node_impl< - typename boost::detail::allocator::rebind_to< + typename rebind_alloc_for< typename Super::allocator_type, char >::type > { typedef random_access_index_node_impl< - typename boost::detail::allocator::rebind_to< + typename rebind_alloc_for< typename Super::allocator_type, char >::type @@ -208,10 +198,11 @@ private: typedef random_access_index_node_trampoline<Super> trampoline; public: - typedef typename trampoline::impl_type impl_type; - typedef typename trampoline::pointer impl_pointer; - typedef typename trampoline::const_pointer const_impl_pointer; - typedef typename trampoline::ptr_pointer impl_ptr_pointer; + typedef typename trampoline::impl_type impl_type; + typedef typename trampoline::pointer impl_pointer; + typedef typename trampoline::const_pointer const_impl_pointer; + typedef typename trampoline::difference_type difference_type; + typedef typename trampoline::ptr_pointer impl_ptr_pointer; impl_ptr_pointer& up(){return trampoline::up();} impl_ptr_pointer up()const{return trampoline::up();} @@ -260,14 +251,14 @@ public: x=from_impl(xi); } - static void advance(random_access_index_node*& x,std::ptrdiff_t n) + static void advance(random_access_index_node*& x,difference_type n) { impl_pointer xi=x->impl(); trampoline::advance(xi,n); x=from_impl(xi); } - static std::ptrdiff_t distance( + static difference_type distance( random_access_index_node* x,random_access_index_node* y) { return trampoline::distance(x->impl(),y->impl()); |