Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 /* Copyright 2003-2005 Joaquín M López Muñoz.
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
6 * See http://www.boost.org/libs/multi_index for library home page.
9 #ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_BASE_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_INDEX_BASE_HPP
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200)
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/call_traits.hpp>
18 #include <boost/detail/workaround.hpp>
19 #include <boost/mpl/vector.hpp>
20 #include <boost/multi_index/detail/copy_map.hpp>
21 #include <boost/multi_index/detail/node_type.hpp>
22 #include <boost/multi_index_container_fwd.hpp>
23 #include <boost/tuple/tuple.hpp>
26 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
27 #include <boost/multi_index/detail/index_loader.hpp>
28 #include <boost/multi_index/detail/index_saver.hpp>
33 namespace multi_index{
37 /* The role of this class is threefold:
38 * - tops the linear hierarchy of indices.
39 * - terminates some cascading backbone function calls (insert_, etc.),
40 * - grants access to the backbone functions of the final
41 * multi_index_container class (for access restriction reasons, these
42 * cannot be called directly from the index classes.)
45 template<typename Value,typename IndexSpecifierList,typename Allocator>
49 typedef index_node_base<Value> node_type;
50 typedef typename multi_index_node_type<
51 Value,IndexSpecifierList,Allocator>::type final_node_type;
52 typedef multi_index_container<
53 Value,IndexSpecifierList,Allocator> final_type;
54 typedef tuples::null_type ctor_args_list;
56 boost::detail::allocator::rebind_to<
58 typename Allocator::value_type>::type final_allocator_type;
59 typedef mpl::vector0<> index_type_list;
60 typedef mpl::vector0<> iterator_type_list;
61 typedef mpl::vector0<> const_iterator_type_list;
64 final_allocator_type> copy_map_type;
66 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
69 final_allocator_type> index_saver_type;
73 final_allocator_type> index_loader_type;
77 typedef typename call_traits<Value>::param_type value_param_type;
80 explicit index_base(const ctor_args_list&,const Allocator&){}
83 const index_base<Value,IndexSpecifierList,Allocator>&,const copy_map_type&)
86 node_type* insert_(value_param_type v,node_type* x)
88 boost::detail::allocator::construct(&x->value(),v);
92 node_type* insert_(value_param_type v,node_type*,node_type* x)
94 boost::detail::allocator::construct(&x->value(),v);
98 void erase_(node_type* x)
100 boost::detail::allocator::destroy(&x->value());
103 void delete_node_(node_type* x)
105 boost::detail::allocator::destroy(&x->value());
110 void swap_(index_base<Value,IndexSpecifierList,Allocator>&){}
112 bool replace_(value_param_type v,node_type* x)
118 bool modify_(node_type*){return true;}
120 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
123 template<typename Archive>
124 void save_(Archive&,const unsigned int,const index_saver_type&)const{}
126 template<typename Archive>
127 void load_(Archive&,const unsigned int,const index_loader_type&){}
130 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
131 /* invariant stuff */
133 bool invariant_()const{return true;}
136 /* access to backbone memfuns of Final class */
138 final_type& final(){return *static_cast<final_type*>(this);}
139 const final_type& final()const{return *static_cast<const final_type*>(this);}
141 final_node_type* final_header()const{return final().header();}
143 bool final_empty_()const{return final().empty_();}
144 std::size_t final_size_()const{return final().size_();}
145 std::size_t final_max_size_()const{return final().max_size_();}
147 std::pair<final_node_type*,bool> final_insert_(value_param_type x)
148 {return final().insert_(x);}
149 std::pair<final_node_type*,bool> final_insert_(
150 value_param_type x,final_node_type* position)
151 {return final().insert_(x,position);}
153 void final_erase_(final_node_type* x){final().erase_(x);}
155 void final_delete_node_(final_node_type* x){final().delete_node_(x);}
156 void final_delete_all_nodes_(){final().delete_all_nodes_();}
157 void final_clear_(){final().clear_();}
159 void final_swap_(final_type& x){final().swap_(x);}
161 value_param_type k,final_node_type* x)
162 {return final().replace_(k,x);}
164 template<typename Modifier>
165 bool final_modify_(Modifier mod,final_node_type* x)
166 {return final().modify_(mod,x);}
168 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
169 void final_check_invariant_()const{final().check_invariant_();}
173 } /* namespace multi_index::detail */
175 } /* namespace multi_index */
177 } /* namespace boost */