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>
documented in the reference section (i.e., it has semi-official status).
</li>
<li>Maintenance work.</li>
</ul>
</p>
@ -617,7 +618,7 @@ Acknowledgements
<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.
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 <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/adl_swap.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/noncopyable.hpp>
#include <memory>
namespace boost{
@ -47,34 +47,16 @@ struct auto_space:private noncopyable
{
typedef typename boost::detail::allocator::rebind_to<
Allocator,T
>::type allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator::pointer pointer;
typedef typename allocator::size_type size_type;
#else
typedef std::allocator_traits<allocator> traits;
typedef typename traits::pointer pointer;
typedef typename traits::size_type size_type;
#endif
>::type allocator;
typedef allocator_traits<allocator> alloc_traits;
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::size_type size_type;
explicit auto_space(const Allocator& al=Allocator(),size_type n=1):
al_(al),n_(n),
#ifdef BOOST_NO_CXX11_ALLOCATOR
data_(n_?al_.allocate(n_):pointer(0))
#else
data_(n_?traits::allocate(al_,n_):pointer(0))
#endif
al_(al),n_(n),data_(n_?alloc_traits::allocate(al_,n_):pointer(0))
{}
~auto_space()
{
if(n_)
#ifdef BOOST_NO_CXX11_ALLOCATOR
al_.deallocate(data_,n_);
#else
traits::deallocate(al_,data_,n_);
#endif
}
~auto_space(){if(n_)alloc_traits::deallocate(al_,data_,n_);}
Allocator get_allocator()const{return al_;}

View File

@ -18,11 +18,10 @@
#include <boost/core/addressof.hpp>
#include <boost/detail/no_exceptions_support.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/noncopyable.hpp>
#include <cstddef>
#include <functional>
#include <memory>
namespace boost{
@ -59,14 +58,15 @@ struct copy_map_entry
template <typename Node,typename Allocator>
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:
typedef const copy_map_entry<Node>* const_iterator;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename Allocator::size_type size_type;
#else
typedef std::allocator_traits<Allocator> traits;
typedef typename traits::size_type size_type;
#endif
typedef const copy_map_entry<Node>* const_iterator;
typedef typename alloc_traits::size_type size_type;
copy_map(
const Allocator& al,size_type size,Node* header_org,Node* header_cpy):
@ -123,40 +123,22 @@ public:
}
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_;
size_type size_;
auto_space<copy_map_entry<Node>,Allocator> spc;
size_type n;
Node* header_org_;
Node* header_cpy_;
bool released;
allocator_type al_;
size_type size_;
auto_space<copy_map_entry<Node>,Allocator> spc;
size_type n;
Node* header_org_;
Node* header_cpy_;
bool released;
allocator_pointer allocate()
pointer allocate()
{
#ifdef BOOST_NO_CXX11_ALLOCATOR
return al_.allocate(1);
#else
return allocator_traits::allocate(al_,1);
#endif
return alloc_traits::allocate(al_,1);
}
void deallocate(Node* node)
{
#ifdef BOOST_NO_CXX11_ALLOCATOR
al_.deallocate(static_cast<allocator_pointer>(node),1);
#else
allocator_traits::deallocate(al_,static_cast<allocator_pointer>(node),1);
#endif
alloc_traits::deallocate(al_,static_cast<pointer>(node),1);
}
};

View File

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

View File

@ -15,9 +15,9 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/raw_ptr.hpp>
#include <utility>
#include <memory>
namespace boost{
@ -103,31 +103,19 @@ struct hashed_index_base_node_impl
typedef typename
boost::detail::allocator::rebind_to<
Allocator,hashed_index_base_node_impl
>::type base_allocator;
>::type base_allocator;
typedef typename
boost::detail::allocator::rebind_to<
Allocator,
hashed_index_node_impl<Allocator>
>::type node_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename base_allocator::pointer base_pointer;
typedef typename base_allocator::const_pointer const_base_pointer;
typedef typename node_allocator::pointer pointer;
typedef typename node_allocator::const_pointer const_pointer;
typedef typename node_allocator::difference_type difference_type;
#else
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
>::type node_allocator;
typedef allocator_traits<base_allocator> base_alloc_traits;
typedef allocator_traits<node_allocator> node_alloc_traits;
typedef typename base_alloc_traits::pointer base_pointer;
typedef typename base_alloc_traits::const_pointer const_base_pointer;
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;
pointer& prior(){return prior_;}
pointer prior()const{return prior_;}

View File

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

View File

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

View File

@ -42,8 +42,8 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <cstddef>
#include <memory>
#include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/raw_ptr.hpp>
#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES)
@ -76,18 +76,11 @@ struct ordered_index_node_traits
Allocator,
ordered_index_node_impl<AugmentPolicy,Allocator>
>::type allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator::pointer pointer;
typedef typename allocator::const_pointer const_pointer;
typedef typename allocator::difference_type difference_type;
typedef typename allocator::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
typedef allocator_traits<allocator> alloc_traits;
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::const_pointer const_pointer;
typedef typename alloc_traits::difference_type difference_type;
typedef typename alloc_traits::size_type size_type;
};
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 <algorithm>
#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/rnd_index_ptr_array.hpp>
#include <boost/noncopyable.hpp>
#include <cstddef>
#include <memory>
namespace boost{
@ -95,12 +94,8 @@ protected:
}
private:
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename Allocator::size_type size_type;
#else
typedef std::allocator_traits<Allocator> allocator_traits;
typedef typename allocator_traits::size_type size_type;
#endif
typedef allocator_traits<Allocator> alloc_traits;
typedef typename alloc_traits::size_type size_type;
void preprocess()
{

View File

@ -17,10 +17,10 @@
#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{
@ -34,27 +34,18 @@ struct random_access_index_node_impl
typedef typename
boost::detail::allocator::rebind_to<
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;
typedef typename node_allocator::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
>::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
boost::detail::allocator::rebind_to<
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_;}

View File

@ -16,11 +16,10 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm>
#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/rnd_index_node.hpp>
#include <boost/noncopyable.hpp>
#include <cstddef>
#include <memory>
namespace boost{
@ -45,14 +44,9 @@ public:
typedef typename boost::detail::allocator::rebind_to<
Allocator,value_type
>::type value_allocator;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename value_allocator::pointer pointer;
typedef typename value_allocator::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
typedef allocator_traits<value_allocator> alloc_traits;
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::size_type size_type;
random_access_index_ptr_array(
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 <algorithm>
#include <memory>
#include <boost/detail/allocator_utilities.hpp>
#include <boost/multi_index/detail/allocator_traits.hpp>
#include <boost/multi_index/detail/raw_ptr.hpp>
namespace boost{
@ -33,17 +33,12 @@ struct sequenced_index_node_impl
typedef typename
boost::detail::allocator::rebind_to<
Allocator,sequenced_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;
typedef typename node_allocator::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
>::type node_allocator;
typedef allocator_traits<node_allocator> alloc_traits;
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::const_pointer const_pointer;
typedef typename alloc_traits::difference_type difference_type;
pointer& prior(){return prior_;}
pointer prior()const{return prior_;}
pointer& next(){return next_;}

View File

@ -27,6 +27,7 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/push_front.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/bucket_array.hpp>
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
@ -45,7 +46,6 @@
#include <functional>
#include <iterator>
#include <utility>
#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list>
@ -103,68 +103,63 @@ class hashed_index:
#pragma parse_mfunc_templ off
#endif
typedef typename SuperMeta::type super;
typedef typename SuperMeta::type super;
protected:
typedef hashed_index_node<
typename super::node_type,Category> node_type;
typename super::node_type,Category> node_type;
private:
typedef typename node_type::node_alg node_alg;
typedef typename node_type::impl_type node_impl_type;
typedef typename node_impl_type::pointer node_impl_pointer;
typedef typename node_impl_type::base_pointer node_impl_base_pointer;
typedef typename node_type::node_alg node_alg;
typedef typename node_type::impl_type node_impl_type;
typedef typename node_impl_type::pointer node_impl_pointer;
typedef typename node_impl_type::base_pointer node_impl_base_pointer;
typedef bucket_array<
typename super::final_allocator_type> bucket_array_type;
typename super::final_allocator_type> bucket_array_type;
public:
/* types */
typedef typename KeyFromValue::result_type key_type;
typedef typename node_type::value_type value_type;
typedef KeyFromValue key_from_value;
typedef Hash hasher;
typedef Pred key_equal;
typedef typename super::final_allocator_type allocator_type;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::pointer pointer;
typedef typename allocator_type::const_pointer const_pointer;
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference;
typedef typename allocator_type::size_type size_type;
typedef typename allocator_type::difference_type difference_type;
#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 const value_type& const_reference;
typedef typename allocator_traits::size_type size_type;
typedef typename allocator_traits::difference_type difference_type;
#endif
typedef typename KeyFromValue::result_type key_type;
typedef typename node_type::value_type value_type;
typedef KeyFromValue key_from_value;
typedef Hash hasher;
typedef Pred key_equal;
typedef typename super::final_allocator_type allocator_type;
private:
typedef allocator_traits<allocator_type> alloc_traits;
public:
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::const_pointer const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename alloc_traits::size_type size_type;
typedef typename alloc_traits::difference_type difference_type;
typedef tuple<size_type,
key_from_value,hasher,key_equal> ctor_args;
key_from_value,hasher,key_equal> ctor_args;
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
typedef safe_mode::safe_iterator<
hashed_index_iterator<
node_type,bucket_array_type,
hashed_index_global_iterator_tag>,
hashed_index> iterator;
hashed_index> iterator;
#else
typedef hashed_index_iterator<
node_type,bucket_array_type,
hashed_index_global_iterator_tag> iterator;
hashed_index_global_iterator_tag> iterator;
#endif
typedef iterator const_iterator;
typedef iterator const_iterator;
typedef hashed_index_iterator<
node_type,bucket_array_type,
hashed_index_local_iterator_tag> local_iterator;
typedef local_iterator const_local_iterator;
hashed_index_local_iterator_tag> local_iterator;
typedef local_iterator const_local_iterator;
typedef TagList tag_list;
typedef TagList tag_list;
protected:
typedef typename super::final_node_type final_node_type;

View File

@ -28,6 +28,7 @@
#include <boost/mpl/not.hpp>
#include <boost/mpl/push_front.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/index_node_base.hpp>
#include <boost/multi_index/detail/rnd_node_iterator.hpp>
@ -44,7 +45,6 @@
#include <functional>
#include <stdexcept>
#include <utility>
#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include<initializer_list>
@ -96,59 +96,50 @@ class random_access_index:
#pragma parse_mfunc_templ off
#endif
typedef typename SuperMeta::type super;
typedef typename SuperMeta::type super;
protected:
typedef random_access_index_node<
typename super::node_type> node_type;
typename super::node_type> node_type;
private:
typedef typename node_type::impl_type node_impl_type;
typedef typename node_type::impl_type node_impl_type;
typedef random_access_index_ptr_array<
typename super::final_allocator_type> ptr_array;
typedef typename ptr_array::pointer node_impl_ptr_pointer;
typename super::final_allocator_type> ptr_array;
typedef typename ptr_array::pointer node_impl_ptr_pointer;
public:
/* types */
typedef typename node_type::value_type value_type;
typedef tuples::null_type ctor_args;
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 const value_type& const_reference;
#endif
typedef typename node_type::value_type value_type;
typedef tuples::null_type ctor_args;
typedef typename super::final_allocator_type allocator_type;
typedef value_type& reference;
typedef const value_type& const_reference;
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
typedef safe_mode::safe_iterator<
rnd_node_iterator<node_type>,
random_access_index> iterator;
random_access_index> iterator;
#else
typedef rnd_node_iterator<node_type> iterator;
typedef rnd_node_iterator<node_type> iterator;
#endif
typedef iterator const_iterator;
typedef iterator const_iterator;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::pointer pointer;
typedef typename allocator_type::const_pointer const_pointer;
typedef typename allocator_type::size_type size_type;
typedef typename allocator_type::difference_type difference_type;
#else
typedef std::allocator_traits<allocator_type> allocator_traits;
typedef typename allocator_traits::pointer pointer;
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
private:
typedef allocator_traits<allocator_type> alloc_traits;
public:
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::const_pointer const_pointer;
typedef typename alloc_traits::size_type size_type;
typedef typename alloc_traits::difference_type difference_type;
typedef typename
boost::reverse_iterator<iterator> reverse_iterator;
boost::reverse_iterator<iterator> reverse_iterator;
typedef typename
boost::reverse_iterator<const_iterator> const_reverse_iterator;
typedef TagList tag_list;
boost::reverse_iterator<const_iterator> const_reverse_iterator;
typedef TagList tag_list;
protected:
typedef typename super::final_node_type final_node_type;

View File

@ -28,6 +28,7 @@
#include <boost/mpl/not.hpp>
#include <boost/mpl/push_front.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/do_not_copy_elements_tag.hpp>
#include <boost/multi_index/detail/index_node_base.hpp>
@ -41,7 +42,6 @@
#include <boost/type_traits/is_integral.hpp>
#include <functional>
#include <utility>
#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include<initializer_list>
@ -91,56 +91,47 @@ class sequenced_index:
#pragma parse_mfunc_templ off
#endif
typedef typename SuperMeta::type super;
typedef typename SuperMeta::type super;
protected:
typedef sequenced_index_node<
typename super::node_type> node_type;
typename super::node_type> node_type;
private:
typedef typename node_type::impl_type node_impl_type;
typedef typename node_type::impl_type node_impl_type;
public:
/* types */
typedef typename node_type::value_type value_type;
typedef tuples::null_type ctor_args;
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 const value_type& const_reference;
#endif
typedef typename node_type::value_type value_type;
typedef tuples::null_type ctor_args;
typedef typename super::final_allocator_type allocator_type;
typedef value_type& reference;
typedef const value_type& const_reference;
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
typedef safe_mode::safe_iterator<
bidir_node_iterator<node_type>,
sequenced_index> iterator;
sequenced_index> iterator;
#else
typedef bidir_node_iterator<node_type> iterator;
typedef bidir_node_iterator<node_type> iterator;
#endif
typedef iterator const_iterator;
typedef iterator const_iterator;
#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::pointer pointer;
typedef typename allocator_type::const_pointer const_pointer;
typedef typename allocator_type::size_type size_type;
typedef typename allocator_type::difference_type difference_type;
#else
typedef std::allocator_traits<allocator_type> allocator_traits;
typedef typename allocator_traits::pointer pointer;
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
private:
typedef allocator_traits<allocator_type> alloc_traits;
public:
typedef typename alloc_traits::pointer pointer;
typedef typename alloc_traits::const_pointer const_pointer;
typedef typename alloc_traits::size_type size_type;
typedef typename alloc_traits::difference_type difference_type;
typedef typename
boost::reverse_iterator<iterator> reverse_iterator;
boost::reverse_iterator<iterator> reverse_iterator;
typedef typename
boost::reverse_iterator<const_iterator> const_reverse_iterator;
typedef TagList tag_list;
boost::reverse_iterator<const_iterator> const_reverse_iterator;
typedef TagList tag_list;
protected:
typedef typename super::final_node_type final_node_type;

View File

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

View File

@ -1,6 +1,6 @@
/* 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.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@ -23,7 +23,6 @@
#include <boost/multi_index/random_access_index.hpp>
#include <boost/multi_index/ranked_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <cstddef>
#include <ostream>
#include <string>
#include "non_std_allocator.hpp"