Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:12

0001 /* Copyright 2003-2023 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See http://www.boost.org/libs/multi_index for library home page.
0007  */
0008 
0009 #ifndef BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP
0010 #define BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP
0011 
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015 
0016 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0017 #include <boost/bind/bind.hpp>
0018 #include <boost/call_traits.hpp>
0019 #include <boost/core/addressof.hpp>
0020 #include <boost/core/no_exceptions_support.hpp>
0021 #include <boost/detail/workaround.hpp>
0022 #include <boost/iterator/reverse_iterator.hpp>
0023 #include <boost/move/core.hpp>
0024 #include <boost/move/utility_core.hpp>
0025 #include <boost/mpl/bool.hpp>
0026 #include <boost/mpl/not.hpp>
0027 #include <boost/mpl/push_front.hpp>
0028 #include <boost/multi_index/detail/access_specifier.hpp>
0029 #include <boost/multi_index/detail/allocator_traits.hpp>
0030 #include <boost/multi_index/detail/bidir_node_iterator.hpp>
0031 #include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
0032 #include <boost/multi_index/detail/index_node_base.hpp>
0033 #include <boost/multi_index/detail/node_handle.hpp>
0034 #include <boost/multi_index/detail/safe_mode.hpp>
0035 #include <boost/multi_index/detail/scope_guard.hpp>
0036 #include <boost/multi_index/detail/seq_index_node.hpp>
0037 #include <boost/multi_index/detail/seq_index_ops.hpp>
0038 #include <boost/multi_index/detail/vartempl_support.hpp>
0039 #include <boost/multi_index/sequenced_index_fwd.hpp>
0040 #include <boost/tuple/tuple.hpp>
0041 #include <boost/type_traits/is_copy_constructible.hpp>
0042 #include <boost/type_traits/is_integral.hpp>
0043 #include <functional>
0044 #include <utility>
0045 
0046 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
0047 #include<initializer_list>
0048 #endif
0049 
0050 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
0051 #define BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF(x)                    \
0052   detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)=                 \
0053     detail::make_obj_guard(x,&sequenced_index::check_invariant_);            \
0054   BOOST_JOIN(check_invariant_,__LINE__).touch();
0055 #define BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT                          \
0056   BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF(*this)
0057 #else
0058 #define BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF(x)
0059 #define BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT
0060 #endif
0061 
0062 namespace boost{
0063 
0064 namespace multi_index{
0065 
0066 namespace detail{
0067 
0068 /* sequenced_index adds a layer of sequenced indexing to a given Super */
0069 
0070 #if defined(BOOST_MSVC)
0071 #pragma warning(push)
0072 #pragma warning(disable:4355) /* this used in base member initializer list */
0073 #endif
0074   
0075 template<typename SuperMeta,typename TagList>
0076 class sequenced_index:
0077   BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type
0078 { 
0079 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\
0080     BOOST_WORKAROUND(__MWERKS__,<=0x3003)
0081 /* The "ISO C++ Template Parser" option in CW8.3 has a problem with the
0082  * lifetime of const references bound to temporaries --precisely what
0083  * scopeguards are.
0084  */
0085 
0086 #pragma parse_mfunc_templ off
0087 #endif
0088 
0089 #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
0090   /* cross-index access */
0091 
0092   template <typename,typename,typename> friend class index_base;
0093 #endif
0094 
0095   typedef typename SuperMeta::type               super;
0096 
0097 protected:
0098   typedef sequenced_index_node<
0099     typename super::index_node_type>             index_node_type;
0100 
0101 private:
0102   typedef typename index_node_type::impl_type    node_impl_type;
0103  
0104 public:
0105   /* types */
0106 
0107   typedef typename index_node_type::value_type   value_type;
0108   typedef tuples::null_type                      ctor_args;
0109   typedef typename super::final_allocator_type   allocator_type;
0110   typedef value_type&                            reference;
0111   typedef const value_type&                      const_reference;
0112 
0113 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0114   typedef safe_mode::safe_iterator<
0115     bidir_node_iterator<index_node_type> >       iterator;
0116 #else
0117   typedef bidir_node_iterator<index_node_type>   iterator;
0118 #endif
0119 
0120   typedef iterator                               const_iterator;
0121 
0122 private:
0123   typedef allocator_traits<allocator_type>       alloc_traits;
0124 
0125 public:
0126   typedef typename alloc_traits::pointer         pointer;
0127   typedef typename alloc_traits::const_pointer   const_pointer;
0128   typedef typename alloc_traits::size_type       size_type;
0129   typedef typename alloc_traits::difference_type difference_type;
0130   typedef typename
0131     boost::reverse_iterator<iterator>            reverse_iterator;
0132   typedef typename
0133     boost::reverse_iterator<const_iterator>      const_reverse_iterator;
0134   typedef typename super::final_node_handle_type node_type;
0135   typedef detail::insert_return_type<
0136     iterator,node_type>                          insert_return_type;
0137   typedef TagList                                tag_list;
0138 
0139 protected:
0140   typedef typename super::final_node_type     final_node_type;
0141   typedef tuples::cons<
0142     ctor_args, 
0143     typename super::ctor_args_list>           ctor_args_list;
0144   typedef typename mpl::push_front<
0145     typename super::index_type_list,
0146     sequenced_index>::type                    index_type_list;
0147   typedef typename mpl::push_front<
0148     typename super::iterator_type_list,
0149     iterator>::type                           iterator_type_list;
0150   typedef typename mpl::push_front<
0151     typename super::const_iterator_type_list,
0152     const_iterator>::type                     const_iterator_type_list;
0153   typedef typename super::copy_map_type       copy_map_type;
0154 
0155 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
0156   typedef typename super::index_saver_type    index_saver_type;
0157   typedef typename super::index_loader_type   index_loader_type;
0158 #endif
0159 
0160 private:
0161 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0162   typedef safe_mode::safe_container<iterator> safe_container;
0163 #endif
0164 
0165   typedef typename call_traits<value_type>::param_type value_param_type;
0166 
0167   /* needed to avoid commas in some macros */
0168 
0169   typedef std::pair<iterator,bool>                     pair_return_type;
0170 
0171 public:
0172 
0173   /* construct/copy/destroy
0174    * Default and copy ctors are in the protected section as indices are
0175    * not supposed to be created on their own. No range ctor either.
0176    */
0177 
0178   sequenced_index<SuperMeta,TagList>& operator=(
0179     const sequenced_index<SuperMeta,TagList>& x)
0180   {
0181     this->final()=x.final();
0182     return *this;
0183   }
0184 
0185 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
0186   sequenced_index<SuperMeta,TagList>& operator=(
0187     std::initializer_list<value_type> list)
0188   {
0189     this->final()=list;
0190     return *this;
0191   }
0192 #endif
0193 
0194   template <class InputIterator>
0195   void assign(InputIterator first,InputIterator last)
0196   {
0197     assign_iter(first,last,mpl::not_<is_integral<InputIterator> >());
0198   }
0199 
0200 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
0201   void assign(std::initializer_list<value_type> list)
0202   {
0203     assign(list.begin(),list.end());
0204   }
0205 #endif
0206 
0207   void assign(size_type n,value_param_type value)
0208   {
0209     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0210     clear();
0211     for(size_type i=0;i<n;++i)push_back(value);
0212   }
0213     
0214   allocator_type get_allocator()const BOOST_NOEXCEPT
0215   {
0216     return this->final().get_allocator();
0217   }
0218 
0219   /* iterators */
0220 
0221   iterator  begin()BOOST_NOEXCEPT
0222     {return make_iterator(index_node_type::from_impl(header()->next()));}
0223   const_iterator begin()const BOOST_NOEXCEPT
0224     {return make_iterator(index_node_type::from_impl(header()->next()));}
0225   iterator
0226     end()BOOST_NOEXCEPT{return make_iterator(header());}
0227   const_iterator
0228     end()const BOOST_NOEXCEPT{return make_iterator(header());}
0229   reverse_iterator
0230     rbegin()BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
0231   const_reverse_iterator
0232     rbegin()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
0233   reverse_iterator
0234     rend()BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
0235   const_reverse_iterator
0236     rend()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
0237   const_iterator
0238     cbegin()const BOOST_NOEXCEPT{return begin();}
0239   const_iterator
0240     cend()const BOOST_NOEXCEPT{return end();}
0241   const_reverse_iterator
0242     crbegin()const BOOST_NOEXCEPT{return rbegin();}
0243   const_reverse_iterator
0244     crend()const BOOST_NOEXCEPT{return rend();}
0245 
0246   iterator iterator_to(const value_type& x)
0247   {
0248     return make_iterator(
0249       node_from_value<index_node_type>(boost::addressof(x)));
0250   }
0251 
0252   const_iterator iterator_to(const value_type& x)const
0253   {
0254     return make_iterator(
0255       node_from_value<index_node_type>(boost::addressof(x)));
0256   }
0257 
0258   /* capacity */
0259 
0260   bool      empty()const BOOST_NOEXCEPT{return this->final_empty_();}
0261   size_type size()const BOOST_NOEXCEPT{return this->final_size_();}
0262   size_type max_size()const BOOST_NOEXCEPT{return this->final_max_size_();}
0263 
0264   void resize(size_type n)
0265   {
0266     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0267     if(n>size()){
0268       for(size_type m=n-size();m--;)
0269         this->final_emplace_(BOOST_MULTI_INDEX_NULL_PARAM_PACK);
0270     }
0271     else if(n<size()){for(size_type m=size()-n;m--;)pop_back();}
0272   }
0273 
0274   void resize(size_type n,value_param_type x)
0275   {
0276     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0277     if(n>size())insert(end(),static_cast<size_type>(n-size()),x);
0278     else if(n<size())for(size_type m=size()-n;m--;)pop_back();
0279   }
0280 
0281   /* access: no non-const versions provided as sequenced_index
0282    * handles const elements.
0283    */
0284 
0285   const_reference front()const{return *begin();}
0286   const_reference back()const{return *--end();}
0287 
0288   /* modifiers */
0289 
0290   BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
0291     pair_return_type,emplace_front,emplace_front_impl)
0292 
0293   std::pair<iterator,bool> push_front(const value_type& x)
0294                              {return insert(begin(),x);}
0295   std::pair<iterator,bool> push_front(BOOST_RV_REF(value_type) x)
0296                              {return insert(begin(),boost::move(x));}
0297   void                     pop_front(){erase(begin());}
0298 
0299   BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
0300     pair_return_type,emplace_back,emplace_back_impl)
0301 
0302   std::pair<iterator,bool> push_back(const value_type& x)
0303                              {return insert(end(),x);}
0304   std::pair<iterator,bool> push_back(BOOST_RV_REF(value_type) x)
0305                              {return insert(end(),boost::move(x));}
0306   void                     pop_back(){erase(--end());}
0307 
0308   BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG(
0309     pair_return_type,emplace,emplace_impl,iterator,position)
0310 
0311   std::pair<iterator,bool> insert(iterator position,const value_type& x)
0312   {
0313     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0314     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0315     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0316     std::pair<final_node_type*,bool> p=this->final_insert_(x);
0317     if(p.second&&position.get_node()!=header()){
0318       relink(position.get_node(),p.first);
0319     }
0320     return std::pair<iterator,bool>(make_iterator(p.first),p.second);
0321   }
0322 
0323   std::pair<iterator,bool> insert(iterator position,BOOST_RV_REF(value_type) x)
0324   {
0325     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0326     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0327     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0328     std::pair<final_node_type*,bool> p=this->final_insert_rv_(x);
0329     if(p.second&&position.get_node()!=header()){
0330       relink(position.get_node(),p.first);
0331     }
0332     return std::pair<iterator,bool>(make_iterator(p.first),p.second);
0333   }
0334 
0335   void insert(iterator position,size_type n,value_param_type x)
0336   {
0337     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0338     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0339     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0340     for(size_type i=0;i<n;++i)insert(position,x);
0341   }
0342  
0343   template<typename InputIterator>
0344   void insert(iterator position,InputIterator first,InputIterator last)
0345   {
0346     insert_iter(position,first,last,mpl::not_<is_integral<InputIterator> >());
0347   }
0348 
0349 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
0350   void insert(iterator position,std::initializer_list<value_type> list)
0351   {
0352     insert(position,list.begin(),list.end());
0353   }
0354 #endif
0355 
0356   insert_return_type insert(const_iterator position,BOOST_RV_REF(node_type) nh)
0357   {
0358     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0359     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0360     if(nh)BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,nh);
0361     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0362     std::pair<final_node_type*,bool> p=this->final_insert_nh_(nh);
0363     if(p.second&&position.get_node()!=header()){
0364       relink(position.get_node(),p.first);
0365     }
0366     return insert_return_type(make_iterator(p.first),p.second,boost::move(nh));
0367   }
0368 
0369   node_type extract(const_iterator position)
0370   {
0371     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0372     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position);
0373     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0374     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0375     return this->final_extract_(
0376       static_cast<final_node_type*>(position.get_node()));
0377   }
0378 
0379   iterator erase(iterator position)
0380   {
0381     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0382     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position);
0383     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0384     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0385     this->final_erase_(static_cast<final_node_type*>(position++.get_node()));
0386     return position;
0387   }
0388   
0389   iterator erase(iterator first,iterator last)
0390   {
0391     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first);
0392     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last);
0393     BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this);
0394     BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this);
0395     BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last);
0396     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0397     while(first!=last){
0398       first=erase(first);
0399     }
0400     return first;
0401   }
0402 
0403   bool replace(iterator position,const value_type& x)
0404   {
0405     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0406     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position);
0407     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0408     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0409     return this->final_replace_(
0410       x,static_cast<final_node_type*>(position.get_node()));
0411   }
0412 
0413   bool replace(iterator position,BOOST_RV_REF(value_type) x)
0414   {
0415     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0416     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position);
0417     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0418     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0419     return this->final_replace_rv_(
0420       x,static_cast<final_node_type*>(position.get_node()));
0421   }
0422 
0423   template<typename Modifier>
0424   bool modify(iterator position,Modifier mod)
0425   {
0426     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0427     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position);
0428     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0429     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0430 
0431 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0432     /* MSVC++ 6.0 optimizer on safe mode code chokes if this
0433      * this is not added. Left it for all compilers as it does no
0434      * harm.
0435      */
0436 
0437     position.detach();
0438 #endif
0439 
0440     return this->final_modify_(
0441       mod,static_cast<final_node_type*>(position.get_node()));
0442   }
0443 
0444   template<typename Modifier,typename Rollback>
0445   bool modify(iterator position,Modifier mod,Rollback back_)
0446   {
0447     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0448     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position);
0449     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0450     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0451 
0452 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0453     /* MSVC++ 6.0 optimizer on safe mode code chokes if this
0454      * this is not added. Left it for all compilers as it does no
0455      * harm.
0456      */
0457 
0458     position.detach();
0459 #endif
0460 
0461     return this->final_modify_(
0462       mod,back_,static_cast<final_node_type*>(position.get_node()));
0463   }
0464 
0465   void swap(sequenced_index<SuperMeta,TagList>& x)
0466   {
0467     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0468     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF(x);
0469     this->final_swap_(x.final());
0470   }
0471 
0472   void clear()BOOST_NOEXCEPT
0473   {
0474     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0475     this->final_clear_();
0476   }
0477 
0478   /* list operations */
0479 
0480   template<typename Index>
0481   BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void)
0482   splice(iterator position,Index& x)
0483   {
0484     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0485     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0486     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0487     if(x.end().get_node()==this->header()){ /* same container */
0488       BOOST_MULTI_INDEX_SAFE_MODE_ASSERT(
0489         position==end(),safe_mode::inside_range);
0490     }
0491     else{
0492       external_splice(
0493         position,x,x.begin(),x.end(),
0494         boost::is_copy_constructible<value_type>());
0495     }
0496   }
0497 
0498   template<typename Index>
0499   BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void)
0500   splice(iterator position,BOOST_RV_REF(Index) x)
0501   {
0502     splice(position,static_cast<Index&>(x));
0503   }
0504 
0505   template<typename Index>
0506   BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(
0507     sequenced_index,Index,pair_return_type)
0508   splice(
0509     iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i)
0510   {
0511     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0512     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0513     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i);
0514     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i);
0515     BOOST_MULTI_INDEX_CHECK_IS_OWNER(i,x);
0516     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0517     if(x.end().get_node()==this->header()){ /* same container */
0518       index_node_type* pn=position.get_node();
0519       index_node_type* in=static_cast<index_node_type*>(i.get_node());
0520       if(pn!=in)relink(pn,in);
0521       return std::pair<iterator,bool>(make_iterator(in),true);
0522     }
0523     else{
0524       std::pair<final_node_type*,bool> p=
0525         external_splice(
0526           position,x,i,boost::is_copy_constructible<value_type>());
0527       return std::pair<iterator,bool>(make_iterator(p.first),p.second);
0528     }
0529   }
0530 
0531   template<typename Index>
0532   BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(
0533     sequenced_index,Index,pair_return_type)
0534   splice(
0535     iterator position,BOOST_RV_REF(Index) x,
0536     BOOST_DEDUCED_TYPENAME Index::iterator i)
0537   {
0538     return splice(position,static_cast<Index&>(x),i);
0539   }
0540 
0541   template<typename Index>
0542   BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void)
0543   splice(
0544     iterator position,Index& x,
0545     BOOST_DEDUCED_TYPENAME Index::iterator first,
0546     BOOST_DEDUCED_TYPENAME Index::iterator last)
0547   {
0548     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0549     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0550     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first);
0551     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last);
0552     BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,x);
0553     BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,x);
0554     BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last);
0555     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0556     if(x.end().get_node()==this->header()){ /* same container */
0557       BOOST_MULTI_INDEX_CHECK_OUTSIDE_RANGE(position,first,last);
0558       internal_splice(position,first,last);
0559     }
0560     else{
0561       external_splice(
0562         position,x,first,last,boost::is_copy_constructible<value_type>());
0563     }
0564   }
0565 
0566   template<typename Index>
0567   BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void)
0568   splice(
0569     iterator position,BOOST_RV_REF(Index) x,
0570     BOOST_DEDUCED_TYPENAME Index::iterator first,
0571     BOOST_DEDUCED_TYPENAME Index::iterator last)
0572   {
0573     splice(position,static_cast<Index&>(x),first,last);
0574   }
0575 
0576   void remove(value_param_type value)
0577   {
0578     sequenced_index_remove(
0579       *this,
0580       ::boost::bind<bool>(
0581         std::equal_to<value_type>(),::boost::arg<1>(),value));
0582   }
0583 
0584   template<typename Predicate>
0585   void remove_if(Predicate pred)
0586   {
0587     sequenced_index_remove(*this,pred);
0588   }
0589 
0590   void unique()
0591   {
0592     sequenced_index_unique(*this,std::equal_to<value_type>());
0593   }
0594 
0595   template <class BinaryPredicate>
0596   void unique(BinaryPredicate binary_pred)
0597   {
0598     sequenced_index_unique(*this,binary_pred);
0599   }
0600 
0601   void merge(sequenced_index<SuperMeta,TagList>& x)
0602   {
0603     sequenced_index_merge(*this,x,std::less<value_type>());
0604   }
0605 
0606   template <typename Compare>
0607   void merge(sequenced_index<SuperMeta,TagList>& x,Compare comp)
0608   {
0609     sequenced_index_merge(*this,x,comp);
0610   }
0611 
0612   void sort()
0613   {
0614     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0615     sequenced_index_sort(header(),std::less<value_type>());
0616   }
0617 
0618   template <typename Compare>
0619   void sort(Compare comp)
0620   {
0621     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0622     sequenced_index_sort(header(),comp);
0623   }
0624 
0625   void reverse()BOOST_NOEXCEPT
0626   {
0627     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0628     node_impl_type::reverse(header()->impl());
0629   }
0630 
0631   /* rearrange operations */
0632 
0633   void relocate(iterator position,iterator i)
0634   {
0635     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0636     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0637     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i);
0638     BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i);
0639     BOOST_MULTI_INDEX_CHECK_IS_OWNER(i,*this);
0640     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0641     if(position!=i)relink(position.get_node(),i.get_node());
0642   }
0643 
0644   void relocate(iterator position,iterator first,iterator last)
0645   {
0646     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0647     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0648     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first);
0649     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last);
0650     BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this);
0651     BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this);
0652     BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last);
0653     BOOST_MULTI_INDEX_CHECK_OUTSIDE_RANGE(position,first,last);
0654     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0655     if(position!=last)relink(
0656       position.get_node(),first.get_node(),last.get_node());
0657   }
0658     
0659   template<typename InputIterator>
0660   void rearrange(InputIterator first)
0661   {
0662     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0663     index_node_type* pos=header();
0664     for(size_type s=size();s--;){
0665       const value_type& v=*first++;
0666       relink(pos,node_from_value<index_node_type>(&v));
0667     }
0668   }
0669 
0670 BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
0671   sequenced_index(const ctor_args_list& args_list,const allocator_type& al):
0672     super(args_list.get_tail(),al)
0673 
0674 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0675     ,safe(*this)
0676 #endif
0677 
0678   {
0679     empty_initialize();
0680   }
0681 
0682   sequenced_index(const sequenced_index<SuperMeta,TagList>& x):
0683     super(x)
0684 
0685 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0686     ,safe(*this)
0687 #endif
0688 
0689   {
0690     /* the actual copying takes place in subsequent call to copy_() */
0691   }
0692 
0693   sequenced_index(
0694     const sequenced_index<SuperMeta,TagList>& x,do_not_copy_elements_tag):
0695     super(x,do_not_copy_elements_tag())
0696 
0697 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0698     ,safe(*this)
0699 #endif
0700 
0701   {
0702     empty_initialize();
0703   }
0704 
0705   ~sequenced_index()
0706   {
0707     /* the container is guaranteed to be empty by now */
0708   }
0709 
0710 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0711   iterator       make_iterator(index_node_type* node)
0712     {return iterator(node,&safe);}
0713   const_iterator make_iterator(index_node_type* node)const
0714     {return const_iterator(node,const_cast<safe_container*>(&safe));}
0715 #else
0716   iterator       make_iterator(index_node_type* node){return iterator(node);}
0717   const_iterator make_iterator(index_node_type* node)const
0718                    {return const_iterator(node);}
0719 #endif
0720 
0721   void copy_(
0722     const sequenced_index<SuperMeta,TagList>& x,const copy_map_type& map)
0723   {
0724     index_node_type* org=x.header();
0725     index_node_type* cpy=header();
0726     do{
0727       index_node_type* next_org=index_node_type::from_impl(org->next());
0728       index_node_type* next_cpy=map.find(
0729         static_cast<final_node_type*>(next_org));
0730       cpy->next()=next_cpy->impl();
0731       next_cpy->prior()=cpy->impl();
0732       org=next_org;
0733       cpy=next_cpy;
0734     }while(org!=x.header());
0735 
0736     super::copy_(x,map);
0737   }
0738 
0739   template<typename Variant>
0740   final_node_type* insert_(
0741     value_param_type v,final_node_type*& x,Variant variant)
0742   {
0743     final_node_type* res=super::insert_(v,x,variant);
0744     if(res==x)link(static_cast<index_node_type*>(x));
0745     return res;
0746   }
0747 
0748   template<typename Variant>
0749   final_node_type* insert_(
0750     value_param_type v,index_node_type* position,
0751     final_node_type*& x,Variant variant)
0752   {
0753     final_node_type* res=super::insert_(v,position,x,variant);
0754     if(res==x)link(static_cast<index_node_type*>(x));
0755     return res;
0756   }
0757 
0758   template<typename Dst>
0759   void extract_(index_node_type* x,Dst dst)
0760   {
0761     unlink(x);
0762     super::extract_(x,dst.next());
0763 
0764 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0765     transfer_iterators(dst.get(),x);
0766 #endif
0767   }
0768 
0769   void delete_all_nodes_()
0770   {
0771     for(index_node_type* x=index_node_type::from_impl(header()->next());
0772         x!=header();){
0773       index_node_type* y=index_node_type::from_impl(x->next());
0774       this->final_delete_node_(static_cast<final_node_type*>(x));
0775       x=y;
0776     }
0777   }
0778 
0779   void clear_()
0780   {
0781     super::clear_();
0782     empty_initialize();
0783 
0784 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0785     safe.detach_dereferenceable_iterators();
0786 #endif
0787   }
0788 
0789   template<typename BoolConstant>
0790   void swap_(
0791     sequenced_index<SuperMeta,TagList>& x,BoolConstant swap_allocators)
0792   {
0793 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0794     safe.swap(x.safe);
0795 #endif
0796 
0797     super::swap_(x,swap_allocators);
0798   }
0799 
0800   void swap_elements_(sequenced_index<SuperMeta,TagList>& x)
0801   {
0802 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0803     safe.swap(x.safe);
0804 #endif
0805 
0806     super::swap_elements_(x);
0807   }
0808 
0809   template<typename Variant>
0810   bool replace_(value_param_type v,index_node_type* x,Variant variant)
0811   {
0812     return super::replace_(v,x,variant);
0813   }
0814 
0815   bool modify_(index_node_type* x)
0816   {
0817     BOOST_TRY{
0818       if(!super::modify_(x)){
0819         unlink(x);
0820 
0821 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0822         detach_iterators(x);
0823 #endif
0824 
0825         return false;
0826       }
0827       else return true;
0828     }
0829     BOOST_CATCH(...){
0830       unlink(x);
0831 
0832 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0833       detach_iterators(x);
0834 #endif
0835 
0836       BOOST_RETHROW;
0837     }
0838     BOOST_CATCH_END
0839   }
0840 
0841   bool modify_rollback_(index_node_type* x)
0842   {
0843     return super::modify_rollback_(x);
0844   }
0845 
0846   bool check_rollback_(index_node_type* x)const
0847   {
0848     return super::check_rollback_(x);
0849   }
0850 
0851 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
0852   /* serialization */
0853 
0854   template<typename Archive>
0855   void save_(
0856     Archive& ar,const unsigned int version,const index_saver_type& sm)const
0857   {
0858     sm.save(begin(),end(),ar,version);
0859     super::save_(ar,version,sm);
0860   }
0861 
0862   template<typename Archive>
0863   void load_(
0864     Archive& ar,const unsigned int version,const index_loader_type& lm)
0865   {
0866     lm.load(
0867       ::boost::bind(
0868         &sequenced_index::rearranger,this,::boost::arg<1>(),::boost::arg<2>()),
0869       ar,version);
0870     super::load_(ar,version,lm);
0871   }
0872 #endif
0873 
0874 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
0875   /* invariant stuff */
0876 
0877   bool invariant_()const
0878   {
0879     if(size()==0||begin()==end()){
0880       if(size()!=0||begin()!=end()||
0881          header()->next()!=header()->impl()||
0882          header()->prior()!=header()->impl())return false;
0883     }
0884     else{
0885       size_type s=0;
0886       for(const_iterator it=begin(),it_end=end();it!=it_end;++it,++s){
0887         if(it.get_node()->next()->prior()!=it.get_node()->impl())return false;
0888         if(it.get_node()->prior()->next()!=it.get_node()->impl())return false;
0889       }
0890       if(s!=size())return false;
0891     }
0892 
0893     return super::invariant_();
0894   }
0895 
0896   /* This forwarding function eases things for the boost::mem_fn construct
0897    * in BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT. Actually,
0898    * final_check_invariant is already an inherited member function of index.
0899    */
0900   void check_invariant_()const{this->final_check_invariant_();}
0901 #endif
0902 
0903 private:
0904   index_node_type* header()const{return this->final_header();}
0905 
0906   void empty_initialize()
0907   {
0908     header()->prior()=header()->next()=header()->impl();
0909   }
0910 
0911   void link(index_node_type* x)
0912   {
0913     node_impl_type::link(x->impl(),header()->impl());
0914   }
0915 
0916   static void unlink(index_node_type* x)
0917   {
0918     node_impl_type::unlink(x->impl());
0919   }
0920 
0921   static void relink(index_node_type* position,index_node_type* x)
0922   {
0923     node_impl_type::relink(position->impl(),x->impl());
0924   }
0925 
0926   static void relink(
0927     index_node_type* position,index_node_type* first,index_node_type* last)
0928   {
0929     node_impl_type::relink(
0930       position->impl(),first->impl(),last->impl());
0931   }
0932 
0933 #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
0934   void rearranger(index_node_type* position,index_node_type *x)
0935   {
0936     if(!position)position=header();
0937     index_node_type::increment(position);
0938     if(position!=x)relink(position,x);
0939   }
0940 #endif
0941 
0942 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
0943   void detach_iterators(index_node_type* x)
0944   {
0945     iterator it=make_iterator(x);
0946     safe_mode::detach_equivalent_iterators(it);
0947   }
0948 
0949   template<typename Dst>
0950   void transfer_iterators(Dst& dst,index_node_type* x)
0951   {
0952     iterator it=make_iterator(x);
0953     safe_mode::transfer_equivalent_iterators(dst,it);
0954   }
0955 #endif
0956 
0957   template <class InputIterator>
0958   void assign_iter(InputIterator first,InputIterator last,mpl::true_)
0959   {
0960     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0961     clear();
0962     for(;first!=last;++first)this->final_insert_ref_(*first);
0963   }
0964 
0965   void assign_iter(size_type n,value_param_type value,mpl::false_)
0966   {
0967     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0968     clear();
0969     for(size_type i=0;i<n;++i)push_back(value);
0970   }
0971 
0972   template<typename InputIterator>
0973   void insert_iter(
0974     iterator position,InputIterator first,InputIterator last,mpl::true_)
0975   {
0976     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0977     for(;first!=last;++first){
0978       std::pair<final_node_type*,bool> p=
0979         this->final_insert_ref_(*first);
0980       if(p.second&&position.get_node()!=header()){
0981         relink(position.get_node(),p.first);
0982       }
0983     }
0984   }
0985 
0986   void insert_iter(
0987     iterator position,size_type n,value_param_type x,mpl::false_)
0988   {
0989     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
0990     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
0991     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
0992     for(size_type i=0;i<n;++i)insert(position,x);
0993   }
0994 
0995   template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
0996   std::pair<iterator,bool> emplace_front_impl(
0997     BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
0998   {
0999     return emplace_impl(begin(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
1000   }
1001 
1002   template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
1003   std::pair<iterator,bool> emplace_back_impl(
1004     BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
1005   {
1006     return emplace_impl(end(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
1007   }
1008 
1009   template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
1010   std::pair<iterator,bool> emplace_impl(
1011     iterator position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
1012   {
1013     BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
1014     BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
1015     BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
1016     std::pair<final_node_type*,bool> p=
1017       this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
1018     if(p.second&&position.get_node()!=header()){
1019       relink(position.get_node(),p.first);
1020     }
1021     return std::pair<iterator,bool>(make_iterator(p.first),p.second);
1022   }
1023 
1024   template<typename Index>
1025   std::pair<final_node_type*,bool> external_splice(
1026     iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i,
1027     boost::true_type /* copy-constructible value */)
1028   {
1029     if(get_allocator()==x.get_allocator()){
1030       return external_splice(position,x,i,boost::false_type());
1031     }
1032     else{
1033       /* backwards compatibility with old, non-transfer-based splice */
1034 
1035       std::pair<iterator,bool> p=insert(position,*i);
1036       if(p.second)x.erase(i);
1037       return std::pair<final_node_type*,bool>(
1038         static_cast<final_node_type*>(p.first.get_node()),p.second);
1039     }
1040   }
1041 
1042   template<typename Index>
1043   std::pair<final_node_type*,bool> external_splice(
1044     iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i,
1045     boost::false_type /* copy-constructible value */)
1046   {
1047     BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x);
1048     std::pair<final_node_type*,bool> p=this->final_transfer_(
1049       x,static_cast<final_node_type*>(i.get_node()));
1050     if(p.second&&position.get_node()!=header()){
1051       relink(position.get_node(),p.first);
1052     }
1053     return p;
1054   }
1055 
1056   template<typename Iterator>
1057   void internal_splice(iterator position,Iterator first,Iterator last)
1058   {
1059     index_node_type* pn=position.get_node();
1060     while(first!=last){
1061       relink(pn,static_cast<index_node_type*>((first++).get_node()));
1062     }
1063   }
1064 
1065   void internal_splice(iterator position,iterator first,iterator last)
1066   {
1067     index_node_type* pn=position.get_node();
1068     index_node_type* fn=static_cast<index_node_type*>(first.get_node());
1069     index_node_type* ln=static_cast<index_node_type*>(last.get_node());
1070     if(pn!=ln)relink(pn,fn,ln);
1071   }
1072 
1073   template<typename Index>
1074   void external_splice(
1075     iterator position,Index& x,
1076     BOOST_DEDUCED_TYPENAME Index::iterator first,
1077     BOOST_DEDUCED_TYPENAME Index::iterator last,
1078     boost::true_type /* copy-constructible value */)
1079   {
1080     if(get_allocator()==x.get_allocator()){
1081       external_splice(position,x,first,last,boost::false_type());
1082     }
1083     else{
1084       /* backwards compatibility with old, non-transfer-based splice */
1085 
1086       while(first!=last){
1087         if(insert(position,*first).second)first=x.erase(first);
1088         else ++first;
1089       }
1090     }
1091   }
1092 
1093   template<typename Index>
1094   void external_splice(
1095     iterator position,Index& x,
1096     BOOST_DEDUCED_TYPENAME Index::iterator first,
1097     BOOST_DEDUCED_TYPENAME Index::iterator last,
1098     boost::false_type /* copy-constructible value */)
1099   {
1100     BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x);
1101     if(position==end()){
1102       this->final_transfer_range_(x,first,last);
1103     }
1104     else{
1105       iterator first_to_relink=end();
1106       --first_to_relink;
1107       BOOST_TRY{
1108         this->final_transfer_range_(x,first,last);
1109       }
1110       BOOST_CATCH(...){
1111         ++first_to_relink;
1112         relink(position.get_node(),first_to_relink.get_node(),header());
1113       }
1114       BOOST_CATCH_END
1115       ++first_to_relink;
1116       relink(position.get_node(),first_to_relink.get_node(),header());
1117     }
1118   }
1119 
1120 #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
1121   safe_container safe;
1122 #endif
1123 
1124 #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\
1125     BOOST_WORKAROUND(__MWERKS__,<=0x3003)
1126 #pragma parse_mfunc_templ reset
1127 #endif
1128 };
1129 
1130 #if defined(BOOST_MSVC)
1131 #pragma warning(pop) /* C4355 */
1132 #endif
1133 
1134 /* comparison */
1135 
1136 template<
1137   typename SuperMeta1,typename TagList1,
1138   typename SuperMeta2,typename TagList2
1139 >
1140 bool operator==(
1141   const sequenced_index<SuperMeta1,TagList1>& x,
1142   const sequenced_index<SuperMeta2,TagList2>& y)
1143 {
1144   return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin());
1145 }
1146 
1147 template<
1148   typename SuperMeta1,typename TagList1,
1149   typename SuperMeta2,typename TagList2
1150 >
1151 bool operator<(
1152   const sequenced_index<SuperMeta1,TagList1>& x,
1153   const sequenced_index<SuperMeta2,TagList2>& y)
1154 {
1155   return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
1156 }
1157 
1158 template<
1159   typename SuperMeta1,typename TagList1,
1160   typename SuperMeta2,typename TagList2
1161 >
1162 bool operator!=(
1163   const sequenced_index<SuperMeta1,TagList1>& x,
1164   const sequenced_index<SuperMeta2,TagList2>& y)
1165 {
1166   return !(x==y);
1167 }
1168 
1169 template<
1170   typename SuperMeta1,typename TagList1,
1171   typename SuperMeta2,typename TagList2
1172 >
1173 bool operator>(
1174   const sequenced_index<SuperMeta1,TagList1>& x,
1175   const sequenced_index<SuperMeta2,TagList2>& y)
1176 {
1177   return y<x;
1178 }
1179 
1180 template<
1181   typename SuperMeta1,typename TagList1,
1182   typename SuperMeta2,typename TagList2
1183 >
1184 bool operator>=(
1185   const sequenced_index<SuperMeta1,TagList1>& x,
1186   const sequenced_index<SuperMeta2,TagList2>& y)
1187 {
1188   return !(x<y);
1189 }
1190 
1191 template<
1192   typename SuperMeta1,typename TagList1,
1193   typename SuperMeta2,typename TagList2
1194 >
1195 bool operator<=(
1196   const sequenced_index<SuperMeta1,TagList1>& x,
1197   const sequenced_index<SuperMeta2,TagList2>& y)
1198 {
1199   return !(x>y);
1200 }
1201 
1202 /*  specialized algorithms */
1203 
1204 template<typename SuperMeta,typename TagList>
1205 void swap(
1206   sequenced_index<SuperMeta,TagList>& x,
1207   sequenced_index<SuperMeta,TagList>& y)
1208 {
1209   x.swap(y);
1210 }
1211 
1212 } /* namespace multi_index::detail */
1213 
1214 /* sequenced index specifier */
1215 
1216 template <typename TagList>
1217 struct sequenced
1218 {
1219   BOOST_STATIC_ASSERT(detail::is_tag<TagList>::value);
1220 
1221   template<typename Super>
1222   struct node_class
1223   {
1224     typedef detail::sequenced_index_node<Super> type;
1225   };
1226 
1227   template<typename SuperMeta>
1228   struct index_class
1229   {
1230     typedef detail::sequenced_index<SuperMeta,typename TagList::type> type;
1231   };
1232 };
1233 
1234 } /* namespace multi_index */
1235 
1236 } /* namespace boost */
1237 
1238 /* Boost.Foreach compatibility */
1239 
1240 namespace boost{
1241 namespace foreach{
1242 
1243 template<typename>
1244 struct is_noncopyable;
1245 
1246 template<typename SuperMeta,typename TagList>
1247 struct is_noncopyable<
1248   boost::multi_index::detail::sequenced_index<SuperMeta,TagList>
1249 >:boost::mpl::true_{};
1250 
1251 }
1252 }
1253 
1254 #undef BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT
1255 #undef BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF
1256 
1257 #endif