File indexing completed on 2025-01-18 09:41:43
0001
0002 #ifndef BOOST_MPL_MAP_AUX_ITERATOR_HPP_INCLUDED
0003 #define BOOST_MPL_MAP_AUX_ITERATOR_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <boost/mpl/map/aux_/map0.hpp>
0019 #include <boost/mpl/map/aux_/at_impl.hpp>
0020 #include <boost/mpl/map/aux_/tag.hpp>
0021 #include <boost/mpl/iterator_tags.hpp>
0022 #include <boost/mpl/if.hpp>
0023 #include <boost/mpl/next.hpp>
0024 #include <boost/mpl/deref.hpp>
0025 #include <boost/mpl/long.hpp>
0026 #include <boost/mpl/void.hpp>
0027 #include <boost/mpl/aux_/nttp_decl.hpp>
0028 #include <boost/mpl/aux_/config/ctps.hpp>
0029
0030 namespace boost { namespace mpl {
0031
0032 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0033
0034 template<
0035 typename Map
0036 , long order
0037 , long max_order
0038 >
0039 struct next_order
0040 : if_<
0041 is_void_< typename item_by_order<Map,order>::type >
0042 , next_order<Map,(order+1),max_order>
0043 , long_<order>
0044 >::type
0045 {
0046 };
0047
0048 template<
0049 typename Map
0050 , long max_order
0051 >
0052 struct next_order<Map,max_order,max_order>
0053 : long_<max_order>
0054 {
0055 };
0056
0057
0058 template< typename Map, long order, long max_order >
0059 struct m_iter
0060 {
0061 typedef forward_iterator_tag category;
0062 typedef typename item_by_order<Map,order>::type type;
0063 };
0064
0065 template< typename Map, long max_order >
0066 struct m_iter<Map,max_order,max_order>
0067 {
0068 typedef forward_iterator_tag category;
0069 };
0070
0071
0072 template< typename Map, long order, long max_order >
0073 struct next< m_iter<Map,order,max_order> >
0074 {
0075 typedef m_iter<
0076 Map
0077 , next_order<Map,order+1,max_order>::value
0078 , max_order
0079 > type;
0080 };
0081
0082 template< typename Map, long max_order >
0083 struct next< m_iter<Map,max_order,max_order> >
0084 {
0085 };
0086
0087 #else
0088
0089 template<
0090 typename Map
0091 , BOOST_MPL_AUX_NTTP_DECL(long, order)
0092 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
0093 >
0094 struct next_order;
0095
0096 template<
0097 typename Map
0098 , BOOST_MPL_AUX_NTTP_DECL(long, order)
0099 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
0100 >
0101 struct next_order_impl
0102 : if_<
0103 is_void_< typename item_by_order<Map,order>::type >
0104 , next_order<Map,(order+1),max_order>
0105 , long_<order>
0106 >::type
0107 {
0108 };
0109
0110 template<
0111 typename Map
0112 , BOOST_MPL_AUX_NTTP_DECL(long, order)
0113 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
0114 >
0115 struct next_order
0116 : if_c<
0117 (order != max_order)
0118 , next_order_impl<Map,order,max_order>
0119 , long_<order>
0120 >::type
0121 {
0122 };
0123
0124
0125 template<
0126 typename Map
0127 , BOOST_MPL_AUX_NTTP_DECL(long, order)
0128 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
0129 >
0130 struct m_iter;
0131
0132 struct m_iter_empty_base {};
0133
0134 template<
0135 typename Map
0136 , BOOST_MPL_AUX_NTTP_DECL(long, order)
0137 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
0138 >
0139 struct m_iter_base
0140 {
0141 typedef typename item_by_order<Map,order>::type type;
0142
0143 typedef m_iter<
0144 Map
0145 , next_order<Map,order+1,max_order>::value
0146 , max_order
0147 > next;
0148 };
0149
0150 template<
0151 typename Map
0152 , BOOST_MPL_AUX_NTTP_DECL(long, order)
0153 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
0154 >
0155 struct m_iter
0156 : if_c<
0157 (order == max_order)
0158 , m_iter_empty_base
0159 , m_iter_base<Map,order,max_order>
0160 >::type
0161 {
0162 typedef forward_iterator_tag category;
0163 };
0164
0165 #endif
0166
0167 }}
0168
0169 #endif