Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_MAP_AUX_ITERATOR_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_MAP_AUX_ITERATOR_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2003-2004
|
Chris@16
|
6 // Copyright David Abrahams 2003-2004
|
Chris@16
|
7 //
|
Chris@16
|
8 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
9 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
10 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
11 //
|
Chris@16
|
12 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
13
|
Chris@101
|
14 // $Id$
|
Chris@101
|
15 // $Date$
|
Chris@101
|
16 // $Revision$
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/mpl/map/aux_/map0.hpp>
|
Chris@16
|
19 #include <boost/mpl/map/aux_/at_impl.hpp>
|
Chris@16
|
20 #include <boost/mpl/map/aux_/tag.hpp>
|
Chris@16
|
21 #include <boost/mpl/iterator_tags.hpp>
|
Chris@16
|
22 #include <boost/mpl/if.hpp>
|
Chris@16
|
23 #include <boost/mpl/next.hpp>
|
Chris@16
|
24 #include <boost/mpl/deref.hpp>
|
Chris@16
|
25 #include <boost/mpl/long.hpp>
|
Chris@16
|
26 #include <boost/mpl/void.hpp>
|
Chris@16
|
27 #include <boost/mpl/aux_/nttp_decl.hpp>
|
Chris@16
|
28 #include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
29
|
Chris@16
|
30 namespace boost { namespace mpl {
|
Chris@16
|
31
|
Chris@16
|
32 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
33
|
Chris@16
|
34 template<
|
Chris@16
|
35 typename Map
|
Chris@16
|
36 , long order
|
Chris@16
|
37 , long max_order
|
Chris@16
|
38 >
|
Chris@16
|
39 struct next_order
|
Chris@16
|
40 : if_<
|
Chris@16
|
41 is_void_< typename item_by_order<Map,order>::type >
|
Chris@16
|
42 , next_order<Map,(order+1),max_order>
|
Chris@16
|
43 , long_<order>
|
Chris@16
|
44 >::type
|
Chris@16
|
45 {
|
Chris@16
|
46 };
|
Chris@16
|
47
|
Chris@16
|
48 template<
|
Chris@16
|
49 typename Map
|
Chris@16
|
50 , long max_order
|
Chris@16
|
51 >
|
Chris@16
|
52 struct next_order<Map,max_order,max_order>
|
Chris@16
|
53 : long_<max_order>
|
Chris@16
|
54 {
|
Chris@16
|
55 };
|
Chris@16
|
56
|
Chris@16
|
57
|
Chris@16
|
58 template< typename Map, long order, long max_order >
|
Chris@16
|
59 struct m_iter
|
Chris@16
|
60 {
|
Chris@16
|
61 typedef forward_iterator_tag category;
|
Chris@16
|
62 typedef typename item_by_order<Map,order>::type type;
|
Chris@16
|
63 };
|
Chris@16
|
64
|
Chris@16
|
65 template< typename Map, long max_order >
|
Chris@16
|
66 struct m_iter<Map,max_order,max_order>
|
Chris@16
|
67 {
|
Chris@16
|
68 typedef forward_iterator_tag category;
|
Chris@16
|
69 };
|
Chris@16
|
70
|
Chris@16
|
71
|
Chris@16
|
72 template< typename Map, long order, long max_order >
|
Chris@16
|
73 struct next< m_iter<Map,order,max_order> >
|
Chris@16
|
74 {
|
Chris@16
|
75 typedef m_iter<
|
Chris@16
|
76 Map
|
Chris@16
|
77 , next_order<Map,order+1,max_order>::value
|
Chris@16
|
78 , max_order
|
Chris@16
|
79 > type;
|
Chris@16
|
80 };
|
Chris@16
|
81
|
Chris@16
|
82 template< typename Map, long max_order >
|
Chris@16
|
83 struct next< m_iter<Map,max_order,max_order> >
|
Chris@16
|
84 {
|
Chris@16
|
85 };
|
Chris@16
|
86
|
Chris@16
|
87 #else
|
Chris@16
|
88
|
Chris@16
|
89 template<
|
Chris@16
|
90 typename Map
|
Chris@16
|
91 , BOOST_MPL_AUX_NTTP_DECL(long, order)
|
Chris@16
|
92 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
|
Chris@16
|
93 >
|
Chris@16
|
94 struct next_order;
|
Chris@16
|
95
|
Chris@16
|
96 template<
|
Chris@16
|
97 typename Map
|
Chris@16
|
98 , BOOST_MPL_AUX_NTTP_DECL(long, order)
|
Chris@16
|
99 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
|
Chris@16
|
100 >
|
Chris@16
|
101 struct next_order_impl
|
Chris@16
|
102 : if_<
|
Chris@16
|
103 is_void_< typename item_by_order<Map,order>::type >
|
Chris@16
|
104 , next_order<Map,(order+1),max_order>
|
Chris@16
|
105 , long_<order>
|
Chris@16
|
106 >::type
|
Chris@16
|
107 {
|
Chris@16
|
108 };
|
Chris@16
|
109
|
Chris@16
|
110 template<
|
Chris@16
|
111 typename Map
|
Chris@16
|
112 , BOOST_MPL_AUX_NTTP_DECL(long, order)
|
Chris@16
|
113 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
|
Chris@16
|
114 >
|
Chris@16
|
115 struct next_order
|
Chris@16
|
116 : if_c<
|
Chris@16
|
117 (order != max_order)
|
Chris@16
|
118 , next_order_impl<Map,order,max_order>
|
Chris@16
|
119 , long_<order>
|
Chris@16
|
120 >::type
|
Chris@16
|
121 {
|
Chris@16
|
122 };
|
Chris@16
|
123
|
Chris@16
|
124
|
Chris@16
|
125 template<
|
Chris@16
|
126 typename Map
|
Chris@16
|
127 , BOOST_MPL_AUX_NTTP_DECL(long, order)
|
Chris@16
|
128 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
|
Chris@16
|
129 >
|
Chris@16
|
130 struct m_iter;
|
Chris@16
|
131
|
Chris@16
|
132 struct m_iter_empty_base {};
|
Chris@16
|
133
|
Chris@16
|
134 template<
|
Chris@16
|
135 typename Map
|
Chris@16
|
136 , BOOST_MPL_AUX_NTTP_DECL(long, order)
|
Chris@16
|
137 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
|
Chris@16
|
138 >
|
Chris@16
|
139 struct m_iter_base
|
Chris@16
|
140 {
|
Chris@16
|
141 typedef typename item_by_order<Map,order>::type type;
|
Chris@16
|
142
|
Chris@16
|
143 typedef m_iter<
|
Chris@16
|
144 Map
|
Chris@16
|
145 , next_order<Map,order+1,max_order>::value
|
Chris@16
|
146 , max_order
|
Chris@16
|
147 > next;
|
Chris@16
|
148 };
|
Chris@16
|
149
|
Chris@16
|
150 template<
|
Chris@16
|
151 typename Map
|
Chris@16
|
152 , BOOST_MPL_AUX_NTTP_DECL(long, order)
|
Chris@16
|
153 , BOOST_MPL_AUX_NTTP_DECL(long, max_order)
|
Chris@16
|
154 >
|
Chris@16
|
155 struct m_iter
|
Chris@16
|
156 : if_c<
|
Chris@16
|
157 (order == max_order)
|
Chris@16
|
158 , m_iter_empty_base
|
Chris@16
|
159 , m_iter_base<Map,order,max_order>
|
Chris@16
|
160 >::type
|
Chris@16
|
161 {
|
Chris@16
|
162 typedef forward_iterator_tag category;
|
Chris@16
|
163 };
|
Chris@16
|
164
|
Chris@16
|
165 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
166
|
Chris@16
|
167 }}
|
Chris@16
|
168
|
Chris@16
|
169 #endif // BOOST_MPL_MAP_AUX_ITERATOR_HPP_INCLUDED
|