refactored 91f21167118564daedafb0224132f7b2b6651e05

This commit is contained in:
joaquintides 2018-12-30 14:59:14 +01:00
parent 9acee043bc
commit c57a6771fd
18 changed files with 274 additions and 305 deletions

View File

@ -73,6 +73,7 @@ Acknowledgements
for motivation). For the moment being, this change is <i>not</i> for motivation). For the moment being, this change is <i>not</i>
documented in the reference section (i.e., it has semi-official status). documented in the reference section (i.e., it has semi-official status).
</li> </li>
<li>Maintenance work.</li>
</ul> </ul>
</p> </p>
@ -617,7 +618,7 @@ Acknowledgements
<br> <br>
<p>Revised December 29th 2018</p> <p>Revised December 30th 2018</p>
<p>&copy; Copyright 2003-2018 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz. <p>&copy; Copyright 2003-2018 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software Distributed under the Boost Software

View File

@ -0,0 +1,104 @@
/* Copyright 2003-2018 Joaquin M Lopez Munoz.
* 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/multi_index for library home page.
*/
#ifndef BOOST_MULTI_INDEX_DETAIL_ALLOCATOR_TRAITS_HPP
#define BOOST_MULTI_INDEX_DETAIL_ALLOCATOR_TRAITS_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#include <memory>
#else
#include <boost/core/pointer_traits.hpp>
#endif
namespace boost{
namespace multi_index{
namespace detail{
/* poor man's replacement of std::allocator_traits */
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<typename Allocator>
struct allocator_traits:std::allocator_traits<Allocator>
{
/* wrap std::allocator_traits alias templates for use in C++03 codebase */
typedef std::allocator_traits<Allocator> super;
template<typename U>
struct rebind_alloc
{
typedef typename super::template rebind_alloc<U> type;
};
template<typename U>
struct rebind_traits
{
typedef typename super::template rebind_traits<U> type;
};
};
#else
/* not a full std::allocator_traits rewrite (not needed) */
template<typename Allocator>
struct allocator_traits
{
typedef Allocator allocator_type;
typedef typename Allocator::value_type value_type;
typedef typename Allocator::pointer pointer;
typedef typename Allocator::const_pointer const_pointer;
typedef typename pointer_traits<pointer>::
template rebind_to<void>::type void_pointer;
typedef typename pointer_traits<pointer>::
template rebind_to<const void>::type const_void_pointer;
typedef typename Allocator::value_type value_type;
typedef typename Allocator::size_type size_type;
typedef typename Allocator::difference_type difference_type;
template<typename U>
struct rebind_alloc
{
typedef typename Allocator::template rebind<U>::other type;
};
template<typename U>
struct rebind_traits
{
typedef allocator_traits<typename rebind_alloc<U>::type> type;
};
static pointer allocate(Allocator& a,size_type n){return a.allocate(n);}
static pointer allocate(Allocator& a,size_type n,const_void_pointer p)
{return a.allocate(n.static_cast<const_pointer>(p));}
static void deallocate(Allocator& a,pointer p,size_type n)
{a.deallocate(p,n);}
static void construct(Allocator& a,pointer p,const value_type& x)
{a.construct(p,x);}
static size_type max_size(Allocator& a)BOOST_NOEXCEPT{return a.max_size();}
};
#endif
} /* namespace multi_index::detail */
} /* namespace multi_index */
} /* namespace boost */
#endif

View File

@ -17,8 +17,8 @@
#include <algorithm> #include <algorithm>
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/adl_swap.hpp> #include <boost/multi_index/detail/adl_swap.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <memory>
namespace boost{ namespace boost{
@ -48,33 +48,15 @@ struct auto_space:private noncopyable
typedef typename boost::detail::allocator::rebind_to< typedef typename boost::detail::allocator::rebind_to<
Allocator,T Allocator,T
>::type allocator; >::type allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<allocator> alloc_traits;
typedef typename allocator::pointer pointer; typedef typename alloc_traits::pointer pointer;
typedef typename allocator::size_type size_type; typedef typename alloc_traits::size_type size_type;
#else
typedef std::allocator_traits<allocator> traits;
typedef typename traits::pointer pointer;
typedef typename traits::size_type size_type;
#endif
explicit auto_space(const Allocator& al=Allocator(),size_type n=1): explicit auto_space(const Allocator& al=Allocator(),size_type n=1):
al_(al),n_(n), al_(al),n_(n),data_(n_?alloc_traits::allocate(al_,n_):pointer(0))
#ifdef BOOST_NO_CXX11_ALLOCATOR
data_(n_?al_.allocate(n_):pointer(0))
#else
data_(n_?traits::allocate(al_,n_):pointer(0))
#endif
{} {}
~auto_space() ~auto_space(){if(n_)alloc_traits::deallocate(al_,data_,n_);}
{
if(n_)
#ifdef BOOST_NO_CXX11_ALLOCATOR
al_.deallocate(data_,n_);
#else
traits::deallocate(al_,data_,n_);
#endif
}
Allocator get_allocator()const{return al_;} Allocator get_allocator()const{return al_;}

View File

@ -18,11 +18,10 @@
#include <boost/core/addressof.hpp> #include <boost/core/addressof.hpp>
#include <boost/detail/no_exceptions_support.hpp> #include <boost/detail/no_exceptions_support.hpp>
#include <boost/multi_index/detail/auto_space.hpp> #include <boost/multi_index/detail/auto_space.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/raw_ptr.hpp> #include <boost/multi_index/detail/raw_ptr.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <cstddef>
#include <functional> #include <functional>
#include <memory>
namespace boost{ namespace boost{
@ -59,14 +58,15 @@ struct copy_map_entry
template <typename Node,typename Allocator> template <typename Node,typename Allocator>
class copy_map:private noncopyable class copy_map:private noncopyable
{ {
typedef typename boost::detail::allocator::rebind_to<
Allocator,Node
>::type allocator_type;
typedef allocator_traits<allocator_type> alloc_traits;
typedef typename alloc_traits::pointer pointer;
public: public:
typedef const copy_map_entry<Node>* const_iterator; typedef const copy_map_entry<Node>* const_iterator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef typename alloc_traits::size_type size_type;
typedef typename Allocator::size_type size_type;
#else
typedef std::allocator_traits<Allocator> traits;
typedef typename traits::size_type size_type;
#endif
copy_map( copy_map(
const Allocator& al,size_type size,Node* header_org,Node* header_cpy): const Allocator& al,size_type size,Node* header_org,Node* header_cpy):
@ -123,16 +123,6 @@ public:
} }
private: private:
typedef typename boost::detail::allocator::rebind_to<
Allocator,Node
>::type allocator_type;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::pointer allocator_pointer;
#else
typedef std::allocator_traits<allocator_type> allocator_traits;
typedef typename allocator_traits::pointer allocator_pointer;
#endif
allocator_type al_; allocator_type al_;
size_type size_; size_type size_;
auto_space<copy_map_entry<Node>,Allocator> spc; auto_space<copy_map_entry<Node>,Allocator> spc;
@ -141,22 +131,14 @@ private:
Node* header_cpy_; Node* header_cpy_;
bool released; bool released;
allocator_pointer allocate() pointer allocate()
{ {
#ifdef BOOST_NO_CXX11_ALLOCATOR return alloc_traits::allocate(al_,1);
return al_.allocate(1);
#else
return allocator_traits::allocate(al_,1);
#endif
} }
void deallocate(Node* node) void deallocate(Node* node)
{ {
#ifdef BOOST_NO_CXX11_ALLOCATOR alloc_traits::deallocate(al_,static_cast<pointer>(node),1);
al_.deallocate(static_cast<allocator_pointer>(node),1);
#else
allocator_traits::deallocate(al_,static_cast<allocator_pointer>(node),1);
#endif
} }
}; };

View File

@ -14,7 +14,6 @@
#endif #endif
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <cstddef>
#include <iterator> #include <iterator>
namespace boost{ namespace boost{

View File

@ -15,9 +15,9 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/raw_ptr.hpp> #include <boost/multi_index/detail/raw_ptr.hpp>
#include <utility> #include <utility>
#include <memory>
namespace boost{ namespace boost{
@ -109,25 +109,13 @@ struct hashed_index_base_node_impl
Allocator, Allocator,
hashed_index_node_impl<Allocator> hashed_index_node_impl<Allocator>
>::type node_allocator; >::type node_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<base_allocator> base_alloc_traits;
typedef typename base_allocator::pointer base_pointer; typedef allocator_traits<node_allocator> node_alloc_traits;
typedef typename base_allocator::const_pointer const_base_pointer; typedef typename base_alloc_traits::pointer base_pointer;
typedef typename node_allocator::pointer pointer; typedef typename base_alloc_traits::const_pointer const_base_pointer;
typedef typename node_allocator::const_pointer const_pointer; typedef typename node_alloc_traits::pointer pointer;
typedef typename node_allocator::difference_type difference_type; typedef typename node_alloc_traits::const_pointer const_pointer;
#else typedef typename node_alloc_traits::difference_type difference_type;
typedef std::allocator_traits<base_allocator> base_allocator_traits;
typedef std::allocator_traits<node_allocator> node_allocator_traits;
typedef typename base_allocator_traits::pointer base_pointer;
typedef typename base_allocator_traits::
const_pointer const_base_pointer;
typedef typename node_allocator_traits::pointer pointer;
typedef typename node_allocator_traits::
const_pointer const_pointer;
typedef typename node_allocator_traits::
difference_type difference_type;
#endif
pointer& prior(){return prior_;} pointer& prior(){return prior_;}
pointer prior()const{return prior_;} pointer prior()const{return prior_;}

View File

@ -21,13 +21,13 @@
#include <boost/move/core.hpp> #include <boost/move/core.hpp>
#include <boost/move/utility.hpp> #include <boost/move/utility.hpp>
#include <boost/mpl/vector.hpp> #include <boost/mpl/vector.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/copy_map.hpp> #include <boost/multi_index/detail/copy_map.hpp>
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
#include <boost/multi_index/detail/node_type.hpp> #include <boost/multi_index/detail/node_type.hpp>
#include <boost/multi_index/detail/vartempl_support.hpp> #include <boost/multi_index/detail/vartempl_support.hpp>
#include <boost/multi_index_container_fwd.hpp> #include <boost/multi_index_container_fwd.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <memory>
#include <utility> #include <utility>
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
@ -87,12 +87,8 @@ protected:
private: private:
typedef Value value_type; typedef Value value_type;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<Allocator> alloc_traits;
typedef typename Allocator::size_type size_type; typedef typename alloc_traits::size_type size_type;
#else
typedef std::allocator_traits<Allocator> traits;
typedef typename traits::size_type size_type;
#endif
protected: protected:
explicit index_base(const ctor_args_list&,const Allocator&){} explicit index_base(const ctor_args_list&,const Allocator&){}

View File

@ -53,6 +53,7 @@
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/push_front.hpp> #include <boost/mpl/push_front.hpp>
#include <boost/multi_index/detail/access_specifier.hpp> #include <boost/multi_index/detail/access_specifier.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/bidir_node_iterator.hpp> #include <boost/multi_index/detail/bidir_node_iterator.hpp>
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
#include <boost/multi_index/detail/index_node_base.hpp> #include <boost/multi_index/detail/index_node_base.hpp>
@ -69,7 +70,6 @@
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <utility> #include <utility>
#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>
@ -163,13 +163,8 @@ public:
value_type,KeyFromValue,Compare> value_compare; value_type,KeyFromValue,Compare> value_compare;
typedef tuple<key_from_value,key_compare> ctor_args; typedef tuple<key_from_value,key_compare> ctor_args;
typedef typename super::final_allocator_type allocator_type; typedef typename super::final_allocator_type allocator_type;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference;
#else
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
#endif
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
typedef safe_mode::safe_iterator< typedef safe_mode::safe_iterator<
@ -181,18 +176,14 @@ public:
typedef iterator const_iterator; typedef iterator const_iterator;
#ifdef BOOST_NO_CXX11_ALLOCATOR private:
typedef typename allocator_type::size_type size_type; typedef allocator_traits<allocator_type> alloc_traits;
typedef typename allocator_type::difference_type difference_type;
typedef typename allocator_type::pointer pointer; public:
typedef typename allocator_type::const_pointer const_pointer; typedef typename alloc_traits::size_type size_type;
#else typedef typename alloc_traits::difference_type difference_type;
typedef std::allocator_traits<allocator_type> allocator_traits; typedef typename alloc_traits::pointer pointer;
typedef typename allocator_traits::size_type size_type; typedef typename alloc_traits::const_pointer const_pointer;
typedef typename allocator_traits::difference_type difference_type;
typedef typename allocator_traits::pointer pointer;
typedef typename allocator_traits::const_pointer const_pointer;
#endif
typedef typename typedef typename
boost::reverse_iterator<iterator> reverse_iterator; boost::reverse_iterator<iterator> reverse_iterator;
typedef typename typedef typename

View File

@ -42,8 +42,8 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <cstddef> #include <cstddef>
#include <memory>
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/raw_ptr.hpp> #include <boost/multi_index/detail/raw_ptr.hpp>
#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES) #if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES)
@ -76,18 +76,11 @@ struct ordered_index_node_traits
Allocator, Allocator,
ordered_index_node_impl<AugmentPolicy,Allocator> ordered_index_node_impl<AugmentPolicy,Allocator>
>::type allocator; >::type allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<allocator> alloc_traits;
typedef typename allocator::pointer pointer; typedef typename alloc_traits::pointer pointer;
typedef typename allocator::const_pointer const_pointer; typedef typename alloc_traits::const_pointer const_pointer;
typedef typename allocator::difference_type difference_type; typedef typename alloc_traits::difference_type difference_type;
typedef typename allocator::size_type size_type; typedef typename alloc_traits::size_type size_type;
#else
typedef std::allocator_traits<allocator> allocator_traits;
typedef typename allocator_traits::pointer pointer;
typedef typename allocator_traits::const_pointer const_pointer;
typedef typename allocator_traits::difference_type difference_type;
typedef typename allocator_traits::size_type size_type;
#endif
}; };
template<typename AugmentPolicy,typename Allocator> template<typename AugmentPolicy,typename Allocator>

View File

@ -16,11 +16,10 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm> #include <algorithm>
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/auto_space.hpp> #include <boost/multi_index/detail/auto_space.hpp>
#include <boost/multi_index/detail/rnd_index_ptr_array.hpp> #include <boost/multi_index/detail/rnd_index_ptr_array.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <cstddef>
#include <memory>
namespace boost{ namespace boost{
@ -95,12 +94,8 @@ protected:
} }
private: private:
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<Allocator> alloc_traits;
typedef typename Allocator::size_type size_type; typedef typename alloc_traits::size_type size_type;
#else
typedef std::allocator_traits<Allocator> allocator_traits;
typedef typename allocator_traits::size_type size_type;
#endif
void preprocess() void preprocess()
{ {

View File

@ -17,10 +17,10 @@
#include <algorithm> #include <algorithm>
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/integer/common_factor_rt.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 <boost/multi_index/detail/raw_ptr.hpp>
#include <cstddef> #include <cstddef>
#include <functional> #include <functional>
#include <memory>
namespace boost{ namespace boost{
@ -35,26 +35,17 @@ struct random_access_index_node_impl
boost::detail::allocator::rebind_to< boost::detail::allocator::rebind_to<
Allocator,random_access_index_node_impl Allocator,random_access_index_node_impl
>::type node_allocator; >::type node_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<node_allocator> node_alloc_traits;
typedef typename node_allocator::pointer pointer; typedef typename node_alloc_traits::pointer pointer;
typedef typename node_allocator::const_pointer const_pointer; typedef typename node_alloc_traits::const_pointer const_pointer;
typedef typename node_allocator::difference_type difference_type; typedef typename node_alloc_traits::difference_type difference_type;
#else
typedef std::allocator_traits<node_allocator> node_traits;
typedef typename node_traits::pointer pointer;
typedef typename node_traits::const_pointer const_pointer;
typedef typename node_traits::difference_type difference_type;
#endif
typedef typename typedef typename
boost::detail::allocator::rebind_to< boost::detail::allocator::rebind_to<
Allocator,pointer Allocator,pointer
>::type ptr_allocator; >::type ptr_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<ptr_allocator> ptr_alloc_traits;
typedef typename ptr_allocator::pointer ptr_pointer; typedef typename ptr_alloc_traits::pointer ptr_pointer;
#else
typedef std::allocator_traits<ptr_allocator> ptr_traits;
typedef typename ptr_traits::pointer ptr_pointer;
#endif
ptr_pointer& up(){return up_;} ptr_pointer& up(){return up_;}
ptr_pointer up()const{return up_;} ptr_pointer up()const{return up_;}

View File

@ -16,11 +16,10 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm> #include <algorithm>
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/auto_space.hpp> #include <boost/multi_index/detail/auto_space.hpp>
#include <boost/multi_index/detail/rnd_index_node.hpp> #include <boost/multi_index/detail/rnd_index_node.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <cstddef>
#include <memory>
namespace boost{ namespace boost{
@ -45,14 +44,9 @@ public:
typedef typename boost::detail::allocator::rebind_to< typedef typename boost::detail::allocator::rebind_to<
Allocator,value_type Allocator,value_type
>::type value_allocator; >::type value_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<value_allocator> alloc_traits;
typedef typename value_allocator::pointer pointer; typedef typename alloc_traits::pointer pointer;
typedef typename value_allocator::size_type size_type; typedef typename alloc_traits::size_type size_type;
#else
typedef std::allocator_traits<value_allocator> allocator_traits;
typedef typename allocator_traits::pointer pointer;
typedef typename allocator_traits::size_type size_type;
#endif
random_access_index_ptr_array( random_access_index_ptr_array(
const Allocator& al,value_type end_,size_type sz): const Allocator& al,value_type end_,size_type sz):

View File

@ -15,8 +15,8 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm> #include <algorithm>
#include <memory>
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/raw_ptr.hpp> #include <boost/multi_index/detail/raw_ptr.hpp>
namespace boost{ namespace boost{
@ -34,16 +34,11 @@ struct sequenced_index_node_impl
boost::detail::allocator::rebind_to< boost::detail::allocator::rebind_to<
Allocator,sequenced_index_node_impl Allocator,sequenced_index_node_impl
>::type node_allocator; >::type node_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef allocator_traits<node_allocator> alloc_traits;
typedef typename node_allocator::pointer pointer; typedef typename alloc_traits::pointer pointer;
typedef typename node_allocator::const_pointer const_pointer; typedef typename alloc_traits::const_pointer const_pointer;
typedef typename node_allocator::difference_type difference_type; typedef typename alloc_traits::difference_type difference_type;
#else
typedef std::allocator_traits<node_allocator> allocator_traits;
typedef typename allocator_traits::pointer pointer;
typedef typename allocator_traits::const_pointer const_pointer;
typedef typename allocator_traits::difference_type difference_type;
#endif
pointer& prior(){return prior_;} pointer& prior(){return prior_;}
pointer prior()const{return prior_;} pointer prior()const{return prior_;}
pointer& next(){return next_;} pointer& next(){return next_;}

View File

@ -27,6 +27,7 @@
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/push_front.hpp> #include <boost/mpl/push_front.hpp>
#include <boost/multi_index/detail/access_specifier.hpp> #include <boost/multi_index/detail/access_specifier.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/auto_space.hpp> #include <boost/multi_index/detail/auto_space.hpp>
#include <boost/multi_index/detail/bucket_array.hpp> #include <boost/multi_index/detail/bucket_array.hpp>
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
@ -45,7 +46,6 @@
#include <functional> #include <functional>
#include <iterator> #include <iterator>
#include <utility> #include <utility>
#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list> #include <initializer_list>
@ -126,22 +126,17 @@ public:
typedef Hash hasher; typedef Hash hasher;
typedef Pred key_equal; typedef Pred key_equal;
typedef typename super::final_allocator_type allocator_type; typedef typename super::final_allocator_type allocator_type;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::pointer pointer; private:
typedef typename allocator_type::const_pointer const_pointer; typedef allocator_traits<allocator_type> alloc_traits;
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference; public:
typedef typename allocator_type::size_type size_type; typedef typename alloc_traits::pointer pointer;
typedef typename allocator_type::difference_type difference_type; typedef typename alloc_traits::const_pointer const_pointer;
#else
typedef std::allocator_traits<allocator_type> allocator_traits;
typedef typename allocator_traits::pointer pointer;
typedef typename allocator_traits::const_pointer const_pointer;
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
typedef typename allocator_traits::size_type size_type; typedef typename alloc_traits::size_type size_type;
typedef typename allocator_traits::difference_type difference_type; typedef typename alloc_traits::difference_type difference_type;
#endif
typedef tuple<size_type, typedef tuple<size_type,
key_from_value,hasher,key_equal> ctor_args; key_from_value,hasher,key_equal> ctor_args;

View File

@ -28,6 +28,7 @@
#include <boost/mpl/not.hpp> #include <boost/mpl/not.hpp>
#include <boost/mpl/push_front.hpp> #include <boost/mpl/push_front.hpp>
#include <boost/multi_index/detail/access_specifier.hpp> #include <boost/multi_index/detail/access_specifier.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
#include <boost/multi_index/detail/index_node_base.hpp> #include <boost/multi_index/detail/index_node_base.hpp>
#include <boost/multi_index/detail/rnd_node_iterator.hpp> #include <boost/multi_index/detail/rnd_node_iterator.hpp>
@ -44,7 +45,6 @@
#include <functional> #include <functional>
#include <stdexcept> #include <stdexcept>
#include <utility> #include <utility>
#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include<initializer_list> #include<initializer_list>
@ -114,13 +114,8 @@ public:
typedef typename node_type::value_type value_type; typedef typename node_type::value_type value_type;
typedef tuples::null_type ctor_args; typedef tuples::null_type ctor_args;
typedef typename super::final_allocator_type allocator_type; typedef typename super::final_allocator_type allocator_type;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference;
#else
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
#endif
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
typedef safe_mode::safe_iterator< typedef safe_mode::safe_iterator<
@ -132,18 +127,14 @@ public:
typedef iterator const_iterator; typedef iterator const_iterator;
#ifdef BOOST_NO_CXX11_ALLOCATOR private:
typedef typename allocator_type::pointer pointer; typedef allocator_traits<allocator_type> alloc_traits;
typedef typename allocator_type::const_pointer const_pointer;
typedef typename allocator_type::size_type size_type; public:
typedef typename allocator_type::difference_type difference_type; typedef typename alloc_traits::pointer pointer;
#else typedef typename alloc_traits::const_pointer const_pointer;
typedef std::allocator_traits<allocator_type> allocator_traits; typedef typename alloc_traits::size_type size_type;
typedef typename allocator_traits::pointer pointer; typedef typename alloc_traits::difference_type difference_type;
typedef typename allocator_traits::const_pointer const_pointer;
typedef typename allocator_traits::size_type size_type;
typedef typename allocator_traits::difference_type difference_type;
#endif
typedef typename typedef typename
boost::reverse_iterator<iterator> reverse_iterator; boost::reverse_iterator<iterator> reverse_iterator;
typedef typename typedef typename

View File

@ -28,6 +28,7 @@
#include <boost/mpl/not.hpp> #include <boost/mpl/not.hpp>
#include <boost/mpl/push_front.hpp> #include <boost/mpl/push_front.hpp>
#include <boost/multi_index/detail/access_specifier.hpp> #include <boost/multi_index/detail/access_specifier.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/bidir_node_iterator.hpp> #include <boost/multi_index/detail/bidir_node_iterator.hpp>
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
#include <boost/multi_index/detail/index_node_base.hpp> #include <boost/multi_index/detail/index_node_base.hpp>
@ -41,7 +42,6 @@
#include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_integral.hpp>
#include <functional> #include <functional>
#include <utility> #include <utility>
#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include<initializer_list> #include<initializer_list>
@ -106,13 +106,8 @@ public:
typedef typename node_type::value_type value_type; typedef typename node_type::value_type value_type;
typedef tuples::null_type ctor_args; typedef tuples::null_type ctor_args;
typedef typename super::final_allocator_type allocator_type; typedef typename super::final_allocator_type allocator_type;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference;
#else
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
#endif
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
typedef safe_mode::safe_iterator< typedef safe_mode::safe_iterator<
@ -124,18 +119,14 @@ public:
typedef iterator const_iterator; typedef iterator const_iterator;
#ifdef BOOST_NO_CXX11_ALLOCATOR private:
typedef typename allocator_type::pointer pointer; typedef allocator_traits<allocator_type> alloc_traits;
typedef typename allocator_type::const_pointer const_pointer;
typedef typename allocator_type::size_type size_type; public:
typedef typename allocator_type::difference_type difference_type; typedef typename alloc_traits::pointer pointer;
#else typedef typename alloc_traits::const_pointer const_pointer;
typedef std::allocator_traits<allocator_type> allocator_traits; typedef typename alloc_traits::size_type size_type;
typedef typename allocator_traits::pointer pointer; typedef typename alloc_traits::difference_type difference_type;
typedef typename allocator_traits::const_pointer const_pointer;
typedef typename allocator_traits::size_type size_type;
typedef typename allocator_traits::difference_type difference_type;
#endif
typedef typename typedef typename
boost::reverse_iterator<iterator> reverse_iterator; boost::reverse_iterator<iterator> reverse_iterator;
typedef typename typedef typename

View File

@ -17,7 +17,6 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm> #include <algorithm>
#include <memory>
#include <boost/core/addressof.hpp> #include <boost/core/addressof.hpp>
#include <boost/detail/allocator_utilities.hpp> #include <boost/detail/allocator_utilities.hpp>
#include <boost/detail/no_exceptions_support.hpp> #include <boost/detail/no_exceptions_support.hpp>
@ -33,6 +32,7 @@
#include <boost/multi_index_container_fwd.hpp> #include <boost/multi_index_container_fwd.hpp>
#include <boost/multi_index/detail/access_specifier.hpp> #include <boost/multi_index/detail/access_specifier.hpp>
#include <boost/multi_index/detail/adl_swap.hpp> #include <boost/multi_index/detail/adl_swap.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/base_type.hpp> #include <boost/multi_index/detail/base_type.hpp>
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp> #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
#include <boost/multi_index/detail/converter.hpp> #include <boost/multi_index/detail/converter.hpp>
@ -91,19 +91,13 @@ class multi_index_container:
Value,IndexSpecifierList,Allocator>::type Value,IndexSpecifierList,Allocator>::type
>::type>, >::type>,
BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS detail::header_holder< BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS detail::header_holder<
#ifndef BOOST_NO_CXX11_ALLOCATOR typename detail::allocator_traits<
typename std::allocator_traits<
#endif
typename boost::detail::allocator::rebind_to< typename boost::detail::allocator::rebind_to<
Allocator, Allocator,
typename detail::multi_index_node_type< typename detail::multi_index_node_type<
Value,IndexSpecifierList,Allocator>::type Value,IndexSpecifierList,Allocator>::type
>::type >::type
#ifdef BOOST_NO_CXX11_ALLOCATOR
::pointer,
#else
>::pointer, >::pointer,
#endif
multi_index_container<Value,IndexSpecifierList,Allocator> >, multi_index_container<Value,IndexSpecifierList,Allocator> >,
public detail::multi_index_base_type< public detail::multi_index_base_type<
Value,IndexSpecifierList,Allocator>::type Value,IndexSpecifierList,Allocator>::type
@ -134,12 +128,8 @@ private:
Allocator, Allocator,
typename super::node_type typename super::node_type
>::type node_allocator; >::type node_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR typedef detail::allocator_traits<node_allocator> node_alloc_traits;
typedef typename node_allocator::pointer node_pointer; typedef typename node_alloc_traits::pointer node_pointer;
#else
typedef std::allocator_traits<node_allocator> node_allocator_traits;
typedef typename node_allocator_traits::pointer node_pointer;
#endif
typedef ::boost::base_from_member< typedef ::boost::base_from_member<
node_allocator> bfm_allocator; node_allocator> bfm_allocator;
typedef detail::header_holder< typedef detail::header_holder<
@ -548,20 +538,12 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
node_type* allocate_node() node_type* allocate_node()
{ {
#ifdef BOOST_NO_CXX11_ALLOCATOR return &*node_alloc_traits::allocate(bfm_allocator::member,1);
return &*bfm_allocator::member.allocate(1);
#else
return &*node_allocator_traits::allocate(bfm_allocator::member,1);
#endif
} }
void deallocate_node(node_type* x) void deallocate_node(node_type* x)
{ {
#ifdef BOOST_NO_CXX11_ALLOCATOR node_alloc_traits::deallocate(bfm_allocator::member,static_cast<node_pointer>(x),1);
bfm_allocator::member.deallocate(static_cast<node_pointer>(x),1);
#else
node_allocator_traits::deallocate(bfm_allocator::member,static_cast<node_pointer>(x),1);
#endif
} }
bool empty_()const bool empty_()const

View File

@ -1,6 +1,6 @@
/* Used in Boost.MultiIndex tests. /* Used in Boost.MultiIndex tests.
* *
* Copyright 2003-2015 Joaquin M Lopez Munoz. * Copyright 2003-2018 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
@ -23,7 +23,6 @@
#include <boost/multi_index/random_access_index.hpp> #include <boost/multi_index/random_access_index.hpp>
#include <boost/multi_index/ranked_index.hpp> #include <boost/multi_index/ranked_index.hpp>
#include <boost/multi_index/sequenced_index.hpp> #include <boost/multi_index/sequenced_index.hpp>
#include <cstddef>
#include <ostream> #include <ostream>
#include <string> #include <string>
#include "non_std_allocator.hpp" #include "non_std_allocator.hpp"