File indexing completed on 2025-01-18 09:42:07
0001
0002
0003
0004
0005
0006
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
0028
0029
0030
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 }
0075
0076 }
0077
0078 }
0079
0080 #endif