Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /* Copyright 2003-2021 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_DETAIL_INDEX_ACCESS_SEQUENCE_HPP
0010 #define BOOST_MULTI_INDEX_DETAIL_INDEX_ACCESS_SEQUENCE_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/mpl/if.hpp>
0018 #include <boost/mpl/size.hpp>
0019 #include <boost/multi_index_container_fwd.hpp>
0020 
0021 namespace boost{
0022 
0023 namespace multi_index{
0024 
0025 namespace detail{
0026 
0027 /* Successive access to the indices of a multi_index_container. Used as dst in
0028  * backbone function extract_(x,dst) to retrieve the destination indices
0029  * where iterators referring to x must be transferred to (in merging
0030  * operations).
0031  */
0032 
0033 template<typename MultiIndexContainer,int N=0>
0034 struct index_access_sequence;
0035 
0036 struct index_access_sequence_terminal
0037 {
0038   index_access_sequence_terminal(void*){}
0039 };
0040 
0041 template<typename MultiIndexContainer,int N>
0042 struct index_access_sequence_normal
0043 {
0044   MultiIndexContainer* p;
0045 
0046   index_access_sequence_normal(MultiIndexContainer* p_):p(p_){}
0047 
0048   typename nth_index<MultiIndexContainer,N>::type&
0049   get(){return p->template get<N>();}
0050 
0051   index_access_sequence<MultiIndexContainer,N+1>
0052   next(){return index_access_sequence<MultiIndexContainer,N+1>(p);}
0053 };
0054 
0055 template<typename MultiIndexContainer,int N>
0056 struct index_access_sequence_base:
0057   mpl::if_c<
0058     N<mpl::size<typename MultiIndexContainer::index_type_list>::type::value,
0059     index_access_sequence_normal<MultiIndexContainer,N>,
0060     index_access_sequence_terminal
0061   >
0062 {};
0063 
0064 template<typename MultiIndexContainer,int N>
0065 struct index_access_sequence:
0066   index_access_sequence_base<MultiIndexContainer,N>::type
0067 {
0068   typedef typename index_access_sequence_base<
0069     MultiIndexContainer,N>::type               super;
0070  
0071   index_access_sequence(MultiIndexContainer* p):super(p){}
0072 };
0073 
0074 } /* namespace multi_index::detail */
0075 
0076 } /* namespace multi_index */
0077 
0078 } /* namespace boost */
0079 
0080 #endif