Produced by Araxis Merge on Thu Nov 17 16:01:41 2011 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | D:\P\boost_1_47_0\boost\fusion\view\ext_ | segmented_iterator.hpp | Fri Nov 11 15:11:50 2011 UTC |
2 | D:\P\boost_1_47_0_native\boost\fusion\view\ext_ | segmented_iterator.hpp | Fri Jan 1 23:00:22 2010 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 10 | 878 |
Changed | 9 | 18 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | All differences in whitespace within lines are ignored |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /*======== ========== ========== ========== ========== ========== ========== ========= | 1 | /*======== ========== ========== ========== ========== ========== ========== ========= | |||
2 | Copyrig ht (c) 200 6 Eric Nie bler | 2 | Copyrig ht (c) 200 6 Eric Nie bler | |||
3 | 3 | |||||
4 | Use, mo dification and distr ibution is subject t o the Boos t Software | 4 | Use, mo dification and distr ibution is subject t o the Boos t Software | |||
5 | License , Version 1.0. (See accompanyi ng file LI CENSE_1_0. txt or cop y at | 5 | License , Version 1.0. (See accompanyi ng file LI CENSE_1_0. txt or cop y at | |||
6 | http:// www.boost. org/LICENS E_1_0.txt) | 6 | http:// www.boost. org/LICENS E_1_0.txt) | |||
7 | ========== ========== ========== ========== ========== ========== ========== ========*/ | 7 | ========== ========== ========== ========== ========== ========== ========== ========*/ | |||
8 | #ifndef FU SION_SEGME NTED_ITERA TOR_EAN_05 032006_102 7 | 8 | #ifndef FU SION_SEGME NTED_ITERA TOR_EAN_05 032006_102 7 | |||
9 | #define FU SION_SEGME NTED_ITERA TOR_EAN_05 032006_102 7 | 9 | #define FU SION_SEGME NTED_ITERA TOR_EAN_05 032006_102 7 | |||
10 | 10 | |||||
11 | #include < boost/mpl/ if.hpp> | 11 | #include < boost/mpl/ if.hpp> | |||
12 | #include < boost/mpl/ int.hpp> | 12 | #include < boost/mpl/ int.hpp> | |||
13 | #include < boost/mpl/ not.hpp> | 13 | #include < boost/mpl/ not.hpp> | |||
14 | #include < boost/mpl/ assert.hpp > | 14 | #include < boost/mpl/ assert.hpp > | |||
15 | #include < boost/mpl/ next_prior .hpp> | 15 | #include < boost/mpl/ next_prior .hpp> | |||
16 | #include < boost/mpl/ placeholde rs.hpp> | 16 | #include < boost/mpl/ placeholde rs.hpp> | |||
17 | #include < boost/type _traits/is _same.hpp> | 17 | #include < boost/type _traits/is _same.hpp> | |||
18 | #include < boost/type _traits/is _reference .hpp> | 18 | #include < boost/type _traits/is _reference .hpp> | |||
19 | #include < boost/type _traits/re move_refer ence.hpp> | 19 | #include < boost/type _traits/re move_refer ence.hpp> | |||
20 | #include < boost/fusi on/support /tag_of.hp p> | 20 | #include < boost/fusi on/support /tag_of.hp p> | |||
21 | #include < boost/fusi on/support /is_sequen ce.hpp> | 21 | #include < boost/fusi on/support /is_sequen ce.hpp> | |||
22 | #include < boost/fusi on/view/fi lter_view. hpp> | 22 | #include < boost/fusi on/view/fi lter_view. hpp> | |||
23 | #include < boost/fusi on/contain er/list/co ns.hpp> // for nil | 23 | #include < boost/fusi on/contain er/list/co ns.hpp> // for nil | |||
24 | #include < boost/fusi on/contain er/generat ion/make_c ons.hpp> | 24 | #include < boost/fusi on/contain er/generat ion/make_c ons.hpp> | |||
25 | #include < boost/fusi on/iterato r/advance. hpp> | 25 | #include < boost/fusi on/iterato r/advance. hpp> | |||
26 | #include < boost/fusi on/iterato r/distance .hpp> | 26 | #include < boost/fusi on/iterato r/distance .hpp> | |||
27 | #include < boost/fusi on/sequenc e/intrinsi c/ext_/seg ments.hpp> | 27 | #include < boost/fusi on/sequenc e/intrinsi c/ext_/seg ments.hpp> | |||
28 | #include < boost/fusi on/support /ext_/is_s egmented.h pp> | 28 | #include < boost/fusi on/support /ext_/is_s egmented.h pp> | |||
29 | 29 | |||||
30 | namespace boost { na mespace fu sion | 30 | namespace boost { na mespace fu sion | |||
31 | { | 31 | { | |||
32 | struct fusion_se quence_tag ; | 32 | struct fusion_se quence_tag ; | |||
33 | 33 | |||||
34 | namesp ace detail | 34 | namesp ace detail | |||
35 | { | 35 | { | |||
36 | us ing mpl::_ ; | 36 | us ing mpl::_ ; | |||
37 | us ing mpl::n ot_; | 37 | us ing mpl::n ot_; | |||
38 | 38 | |||||
39 | // ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | 39 | // ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | |||
40 | te mplate<typ ename Sequ ence> | 40 | te mplate<typ ename Sequ ence> | |||
41 | st ruct is_em pty | 41 | st ruct is_em pty | |||
42 | : result_o f::equal_t o< | 42 | : result_o f::equal_t o< | |||
43 | type name resul t_of::begi n<Sequence >::type | 43 | type name resul t_of::begi n<Sequence >::type | |||
44 | , type name resul t_of::end< Sequence>: :type | 44 | , type name resul t_of::end< Sequence>: :type | |||
45 | > | 45 | > | |||
46 | {} ; | 46 | {} ; | |||
47 | 47 | |||||
48 | te mplate<typ ename Sequ ence> | 48 | te mplate<typ ename Sequ ence> | |||
49 | st ruct is_em pty<Sequen ce &> | 49 | st ruct is_em pty<Sequen ce &> | |||
50 | : is_empty <Sequence> | 50 | : is_empty <Sequence> | |||
51 | {} ; | 51 | {} ; | |||
52 | 52 | |||||
53 | // ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | 53 | // ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | |||
54 | st ruct not_i s_empty_pr ed | 54 | st ruct not_i s_empty_pr ed | |||
55 | { | 55 | { | |||
56 | template <typename Sequence> | 56 | template <typename Sequence> | |||
57 | struct a pply | 57 | struct a pply | |||
58 | : not_ <is_empty< Sequence> > | 58 | : not_ <is_empty< Sequence> > | |||
59 | {}; | 59 | {}; | |||
60 | }; | 60 | }; | |||
61 | 61 | |||||
62 | st ruct segme nted_range _tag; | 62 | st ruct segme nted_range _tag; | |||
63 | 63 | |||||
64 | // ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | 64 | // ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | |||
65 | te mplate<typ ename Sequ ence, type name Index , bool IsS egmented> | 65 | te mplate<typ ename Sequ ence, type name Index , bool IsS egmented> | |||
66 | st ruct segme nted_range | 66 | st ruct segme nted_range | |||
67 | : sequence _base<segm ented_rang e<Sequence , Index, I sSegmented > > | 67 | : sequence _base<segm ented_rang e<Sequence , Index, I sSegmented > > | |||
68 | { | 68 | { | |||
69 | BOOST_MP L_ASSERT_N OT((is_ref erence<Seq uence>)); | 69 | BOOST_MP L_ASSERT_N OT((is_ref erence<Seq uence>)); | |||
70 | typedef mpl::bool_ <IsSegment ed> is_seg mented; | 70 | typedef mpl::bool_ <IsSegment ed> is_seg mented; | |||
71 | typedef segmented_ range_tag fusion_tag ; | 71 | typedef segmented_ range_tag fusion_tag ; | |||
72 | typedef fusion_seq uence_tag tag; // th is gets pi cked up by MPL | 72 | typedef fusion_seq uence_tag tag; // th is gets pi cked up by MPL | |||
73 | typedef mpl::true_ is_view; | 73 | typedef mpl::true_ is_view; | |||
74 | 74 | |||||
75 | // If th is is a ra nge of seg ments, ski p over the empty one s | 75 | // If th is is a ra nge of seg ments, ski p over the empty one s | |||
76 | typedef typename m pl::if_< | 76 | typedef typename m pl::if_< | |||
77 | is_s egmented | 77 | is_s egmented | |||
78 | , filt er_view<Se quence, no t_is_empty _pred> | 78 | , filt er_view<Se quence, no t_is_empty _pred> | |||
79 | , Sequ ence | 79 | , Sequ ence | |||
80 | >::type sequence_n on_ref_typ e; | 80 | >::type sequence_n on_ref_typ e; | |||
81 | 81 | |||||
82 | typedef typename m pl::if_< | 82 | typedef typename m pl::if_< | |||
83 | trai ts::is_vie w<sequence _non_ref_t ype> | 83 | trai ts::is_vie w<sequence _non_ref_t ype> | |||
84 | , sequ ence_non_r ef_type | 84 | , sequ ence_non_r ef_type | |||
85 | , sequ ence_non_r ef_type & | 85 | , sequ ence_non_r ef_type & | |||
86 | >::type sequence_t ype; | 86 | >::type sequence_t ype; | |||
87 | 87 | |||||
88 | typedef | 88 | typedef | |||
89 | type name fusio n::result_ of::advanc e< | 89 | type name fusio n::result_ of::advanc e< | |||
90 | typename f usion::res ult_of::be gin<sequen ce_non_ref _type>::ty pe | 90 | typename f usion::res ult_of::be gin<sequen ce_non_ref _type>::ty pe | |||
91 | , Index | 91 | , Index | |||
92 | >::t ype | 92 | >::t ype | |||
93 | iterator _type; | 93 | iterator _type; | |||
94 | 94 | |||||
95 | typedef typename t raits::cat egory_of<s equence_no n_ref_type >::type ca tegory; | 95 | typedef typename t raits::cat egory_of<s equence_no n_ref_type >::type ca tegory; | |||
96 | 96 | |||||
97 | explicit segmented _range(Seq uence &seq uence_) | 97 | explicit segmented _range(Seq uence &seq uence_) | |||
98 | : sequ ence(seque nce_type(s equence_)) | 98 | : sequ ence(seque nce_type(s equence_)) | |||
99 | {} | 99 | {} | |||
100 | 100 | |||||
101 | segmente d_range(se quence_typ e sequence _, int) | 101 | segmente d_range(se quence_typ e sequence _, int) | |||
102 | : sequ ence(seque nce_) | 102 | : sequ ence(seque nce_) | |||
103 | {} | 103 | {} | |||
104 | 104 | |||||
105 | iterator _type wher e_() const | 105 | iterator _type wher e_() const | |||
106 | { | 106 | { | |||
107 | retu rn fusion: :advance<I ndex>( | 107 | retu rn fusion: :advance<I ndex>( | |||
108 | fusion::be gin(const_ cast<seque nce_non_re f_type &>( this->sequ ence)) | 108 | fusion::be gin(const_ cast<seque nce_non_re f_type &>( this->sequ ence)) | |||
109 | ); | 109 | ); | |||
110 | } | 110 | } | |||
111 | 111 | |||||
112 | sequence _type sequ ence; | 112 | sequence _type sequ ence; | |||
113 | 113 | |||||
114 | pr ivate: | 114 | pr ivate: | |||
115 | segmente d_range &o perator =( segmented_ range cons t &); | 115 | segmente d_range &o perator =( segmented_ range cons t &); | |||
116 | }; | 116 | }; | |||
117 | } | 117 | } | |||
118 | 118 | |||||
119 | namesp ace extens ion | 119 | namesp ace extens ion | |||
120 | { | 120 | { | |||
121 | te mplate<> | 121 | te mplate<> | |||
122 | st ruct is_se gmented_im pl<detail: :segmented _range_tag > | 122 | st ruct is_se gmented_im pl<detail: :segmented _range_tag > | |||
123 | { | 123 | { | |||
124 | template <typename Sequence> | 124 | template <typename Sequence> | |||
125 | struct a pply | 125 | struct a pply | |||
126 | : Sequ ence::is_s egmented | 126 | : Sequ ence::is_s egmented | |||
127 | {}; | 127 | {}; | |||
128 | }; | 128 | }; | |||
129 | 129 | |||||
130 | te mplate<> | 130 | te mplate<> | |||
131 | st ruct size_ impl<detai l::segment ed_range_t ag> | 131 | st ruct size_ impl<detai l::segment ed_range_t ag> | |||
132 | { | 132 | { | |||
133 | template <typename Sequence> | 133 | template <typename Sequence> | |||
134 | struct a pply | 134 | struct a pply | |||
135 | : mpl: :int_< | 135 | : mpl: :int_< | |||
136 | result_of: :distance< | 136 | result_of: :distance< | |||
137 | typena me Sequenc e::iterato r_type | 137 | typena me Sequenc e::iterato r_type | |||
138 | , typena me result_ of::end<ty pename Seq uence::seq uence_non_ ref_type>: :type | 138 | , typena me result_ of::end<ty pename Seq uence::seq uence_non_ ref_type>: :type | |||
139 | >::value | 139 | >::value | |||
140 | > | 140 | > | |||
141 | {}; | 141 | {}; | |||
142 | }; | 142 | }; | |||
143 | 143 | |||||
144 | te mplate<> | 144 | te mplate<> | |||
145 | st ruct segme nts_impl<d etail::seg mented_ran ge_tag> | 145 | st ruct segme nts_impl<d etail::seg mented_ran ge_tag> | |||
146 | { | 146 | { | |||
147 | template <typename Sequence> | 147 | template <typename Sequence> | |||
148 | struct a pply | 148 | struct a pply | |||
149 | { | 149 | { | |||
150 | type def Sequen ce &type; | 150 | type def Sequen ce &type; | |||
151 | stat ic type ca ll(Sequenc e &seq) | 151 | stat ic type ca ll(Sequenc e &seq) | |||
152 | { | 152 | { | |||
153 | return seq ; | 153 | return seq ; | |||
154 | } | 154 | } | |||
155 | }; | 155 | }; | |||
156 | }; | 156 | }; | |||
157 | 157 | |||||
158 | te mplate<> | 158 | te mplate<> | |||
159 | st ruct begin _impl<deta il::segmen ted_range_ tag> | 159 | st ruct begin _impl<deta il::segmen ted_range_ tag> | |||
160 | { | 160 | { | |||
161 | template <typename Sequence> | 161 | template <typename Sequence> | |||
162 | struct a pply | 162 | struct a pply | |||
163 | { | 163 | { | |||
164 | type def typena me Sequenc e::iterato r_type typ e; | 164 | type def typena me Sequenc e::iterato r_type typ e; | |||
165 | stat ic type ca ll(Sequenc e &seq) | 165 | stat ic type ca ll(Sequenc e &seq) | |||
166 | { | 166 | { | |||
167 | return seq .where_(); | 167 | return seq .where_(); | |||
168 | } | 168 | } | |||
169 | }; | 169 | }; | |||
170 | }; | 170 | }; | |||
171 | 171 | |||||
172 | te mplate<> | 172 | te mplate<> | |||
173 | st ruct end_i mpl<detail ::segmente d_range_ta g> | 173 | st ruct end_i mpl<detail ::segmente d_range_ta g> | |||
174 | { | 174 | { | |||
175 | template <typename Sequence> | 175 | template <typename Sequence> | |||
176 | struct a pply | 176 | struct a pply | |||
177 | { | 177 | { | |||
178 | type def typena me Sequenc e::sequenc e_non_ref_ type seque nce; | 178 | type def typena me Sequenc e::sequenc e_non_ref_ type seque nce; | |||
179 | type def typena me result_ of::end<se quence>::t ype type; | 179 | type def typena me result_ of::end<se quence>::t ype type; | |||
180 | 180 | |||||
181 | stat ic type ca ll(Sequenc e &seq) | 181 | stat ic type ca ll(Sequenc e &seq) | |||
182 | { | 182 | { | |||
183 | return fus ion::end(s eq.sequenc e); | 183 | return fus ion::end(s eq.sequenc e); | |||
184 | } | 184 | } | |||
185 | }; | 185 | }; | |||
186 | }; | 186 | }; | |||
187 | } | 187 | } | |||
188 | 188 | |||||
189 | namesp ace detail | 189 | namesp ace detail | |||
190 | { | 190 | { | |||
191 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | 191 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | |||
192 | te mplate<typ ename Rang e> | 192 | te mplate<typ ename Rang e> | |||
193 | st ruct range _next; | 193 | st ruct range _next; | |||
194 | 194 | |||||
195 | te mplate<typ ename Sequ ence, type name Index , bool IsS egmented> | 195 | te mplate<typ ename Sequ ence, type name Index , bool IsS egmented> | |||
196 | st ruct range _next<segm ented_rang e<Sequence , Index, I sSegmented > > | 196 | st ruct range _next<segm ented_rang e<Sequence , Index, I sSegmented > > | |||
197 | { | 197 | { | |||
198 | typedef typename m pl::next<I ndex>::typ e index_ty pe; | 198 | typedef typename m pl::next<I ndex>::typ e index_ty pe; | |||
199 | typedef segmented_ range<Sequ ence, inde x_type, Is Segmented> type; | 199 | typedef segmented_ range<Sequ ence, inde x_type, Is Segmented> type; | |||
200 | 200 | |||||
201 | static t ype call(s egmented_r ange<Seque nce, Index , IsSegmen ted> const &rng) | 201 | static t ype call(s egmented_r ange<Seque nce, Index , IsSegmen ted> const &rng) | |||
202 | { | 202 | { | |||
203 | retu rn type(rn g.sequence , 0); | 203 | retu rn type(rn g.sequence , 0); | |||
204 | } | 204 | } | |||
205 | }; | 205 | }; | |||
206 | 206 | |||||
207 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | 207 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | |||
208 | te mplate<typ ename Cons > | 208 | te mplate<typ ename Cons > | |||
209 | st ruct is_ra nge_next_e mpty | 209 | st ruct is_ra nge_next_e mpty | |||
210 | : is_empty <typename range_next <typename Cons::car_ type>::typ e> | 210 | : is_empty <typename range_next <typename Cons::car_ type>::typ e> | |||
211 | {} ; | 211 | {} ; | |||
212 | 212 | |||||
213 | te mplate<> | 213 | te mplate<> | |||
214 | struct is_range_n ext_empty< nil _t > | 214 |
struct
is_range_n
ext_empty<
nil
|
|||
215 | : mpl::tru e_ | 215 | : mpl::tru e_ | |||
216 | {} ; | 216 | {} ; | |||
217 | 217 | |||||
218 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | 218 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | |||
219 | te mplate<typ ename Sequ ence, bool IsSegment ed = trait s::is_segm ented<Sequ ence>::val ue> | 219 | te mplate<typ ename Sequ ence, bool IsSegment ed = trait s::is_segm ented<Sequ ence>::val ue> | |||
220 | st ruct as_se gmented_ra nge | 220 | st ruct as_se gmented_ra nge | |||
221 | { | 221 | { | |||
222 | typedef typename r esult_of:: segments<S equence>:: type segme nts; | 222 | typedef typename r esult_of:: segments<S equence>:: type segme nts; | |||
223 | typedef typename r emove_refe rence<segm ents>::typ e sequence ; | 223 | typedef typename r emove_refe rence<segm ents>::typ e sequence ; | |||
224 | typedef segmented_ range<sequ ence, mpl: :int_<0>, true> type ; | 224 | typedef segmented_ range<sequ ence, mpl: :int_<0>, true> type ; | |||
225 | 225 | |||||
226 | static t ype call(S equence &s eq) | 226 | static t ype call(S equence &s eq) | |||
227 | { | 227 | { | |||
228 | segm ents segs( fusion::se gments(seq )); | 228 | segm ents segs( fusion::se gments(seq )); | |||
229 | retu rn type(se gs); | 229 | retu rn type(se gs); | |||
230 | } | 230 | } | |||
231 | }; | 231 | }; | |||
232 | 232 | |||||
233 | te mplate<typ ename Sequ ence> | 233 | te mplate<typ ename Sequ ence> | |||
234 | st ruct as_se gmented_ra nge<Sequen ce, false> | 234 | st ruct as_se gmented_ra nge<Sequen ce, false> | |||
235 | { | 235 | { | |||
236 | typedef typename r emove_refe rence<Sequ ence>::typ e sequence ; | 236 | typedef typename r emove_refe rence<Sequ ence>::typ e sequence ; | |||
237 | typedef segmented_ range<sequ ence, mpl: :int_<0>, false> typ e; | 237 | typedef segmented_ range<sequ ence, mpl: :int_<0>, false> typ e; | |||
238 | 238 | |||||
239 | static t ype call(S equence &s eq) | 239 | static t ype call(S equence &s eq) | |||
240 | { | 240 | { | |||
241 | retu rn type(se q); | 241 | retu rn type(se q); | |||
242 | } | 242 | } | |||
243 | }; | 243 | }; | |||
244 | 244 | |||||
245 | te mplate<typ ename Sequ ence, type name Index , bool IsS egmented> | 245 | te mplate<typ ename Sequ ence, type name Index , bool IsS egmented> | |||
246 | st ruct as_se gmented_ra nge<segmen ted_range< Sequence, Index, IsS egmented>, IsSegment ed> | 246 | st ruct as_se gmented_ra nge<segmen ted_range< Sequence, Index, IsS egmented>, IsSegment ed> | |||
247 | { | 247 | { | |||
248 | typedef segmented_ range<Sequ ence, Inde x, IsSegme nted> type ; | 248 | typedef segmented_ range<Sequ ence, Inde x, IsSegme nted> type ; | |||
249 | static t ype &call( type &seq) | 249 | static t ype &call( type &seq) | |||
250 | { | 250 | { | |||
251 | retu rn seq; | 251 | retu rn seq; | |||
252 | } | 252 | } | |||
253 | }; | 253 | }; | |||
254 | 254 | |||||
255 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | 255 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | |||
256 | te mplate< | 256 | te mplate< | |||
257 | typename Sequence | 257 | typename Sequence | |||
258 | , typename State = nil _t | 258 |
,
typename
State
=
nil
|
|||
259 | , bool IsS egmented = traits::i s_segmente d<Sequence >::value | 259 | , bool IsS egmented = traits::i s_segmente d<Sequence >::value | |||
260 | > | 260 | > | |||
261 | st ruct push_ segments | 261 | st ruct push_ segments | |||
262 | { | 262 | { | |||
263 | typedef typename a s_segmente d_range<Se quence>::t ype range; | 263 | typedef typename a s_segmente d_range<Se quence>::t ype range; | |||
264 | typedef typename r esult_of:: begin<rang e>::type b egin; | 264 | typedef typename r esult_of:: begin<rang e>::type b egin; | |||
265 | typedef typename r esult_of:: deref<begi n>::type n ext_ref; | 265 | typedef typename r esult_of:: deref<begi n>::type n ext_ref; | |||
266 | typedef typename r emove_refe rence<next _ref>::typ e next; | 266 | typedef typename r emove_refe rence<next _ref>::typ e next; | |||
267 | typedef push_segme nts<next, cons<range , State> > push; | 267 | typedef push_segme nts<next, cons<range , State> > push; | |||
268 | typedef typename p ush::type type; | 268 | typedef typename p ush::type type; | |||
269 | 269 | |||||
270 | static t ype call(S equence &s eq, State const &sta te) | 270 | static t ype call(S equence &s eq, State const &sta te) | |||
271 | { | 271 | { | |||
272 | rang e rng(as_s egmented_r ange<Seque nce>::call (seq)); | 272 | rang e rng(as_s egmented_r ange<Seque nce>::call (seq)); | |||
273 | next _ref nxt(* fusion::be gin(rng)); | 273 | next _ref nxt(* fusion::be gin(rng)); | |||
274 | retu rn push::c all(nxt, f usion::mak e_cons(rng , state)); | 274 | retu rn push::c all(nxt, f usion::mak e_cons(rng , state)); | |||
275 | } | 275 | } | |||
276 | }; | 276 | }; | |||
277 | 277 | |||||
278 | te mplate<typ ename Sequ ence, type name State > | 278 | te mplate<typ ename Sequ ence, type name State > | |||
279 | st ruct push_ segments<S equence, S tate, fals e> | 279 | st ruct push_ segments<S equence, S tate, fals e> | |||
280 | { | 280 | { | |||
281 | typedef typename a s_segmente d_range<Se quence>::t ype range; | 281 | typedef typename a s_segmente d_range<Se quence>::t ype range; | |||
282 | typedef cons<range , State> t ype; | 282 | typedef cons<range , State> t ype; | |||
283 | 283 | |||||
284 | static t ype call(S equence &s eq, State const &sta te) | 284 | static t ype call(S equence &s eq, State const &sta te) | |||
285 | { | 285 | { | |||
286 | rang e rng(as_s egmented_r ange<Seque nce>::call (seq)); | 286 | rang e rng(as_s egmented_r ange<Seque nce>::call (seq)); | |||
287 | retu rn fusion: :make_cons (rng, stat e); | 287 | retu rn fusion: :make_cons (rng, stat e); | |||
288 | } | 288 | } | |||
289 | }; | 289 | }; | |||
290 | 290 | |||||
291 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | 291 | // ////////// ////////// ////////// ////////// ////////// ////////// ///////// | |||
292 | te mplate<typ ename Stat e, bool Is Empty = is _range_nex t_empty<St ate>::valu e> | 292 | te mplate<typ ename Stat e, bool Is Empty = is _range_nex t_empty<St ate>::valu e> | |||
293 | st ruct pop_s egments | 293 | st ruct pop_s egments | |||
294 | { | 294 | { | |||
295 | typedef range_next <typename State::car _type> nex t; | 295 | typedef range_next <typename State::car _type> nex t; | |||
296 | typedef push_segme nts<typena me next::t ype, typen ame State: :cdr_type> push; | 296 | typedef push_segme nts<typena me next::t ype, typen ame State: :cdr_type> push; | |||
297 | typedef typename p ush::type type; | 297 | typedef typename p ush::type type; | |||
298 | 298 | |||||
299 | static t ype call(S tate const &state) | 299 | static t ype call(S tate const &state) | |||
300 | { | 300 | { | |||
301 | type name next: :type rng( next::call (state.car )); | 301 | type name next: :type rng( next::call (state.car )); | |||
302 | retu rn push::c all(rng, s tate.cdr); | 302 | retu rn push::c all(rng, s tate.cdr); | |||
303 | } | 303 | } | |||
304 | }; | 304 | }; | |||
305 | 305 | |||||
306 | te mplate<typ ename Stat e> | 306 | te mplate<typ ename Stat e> | |||
307 | st ruct pop_s egments<St ate, true> | 307 | st ruct pop_s egments<St ate, true> | |||
308 | { | 308 | { | |||
309 | typedef pop_segmen ts<typenam e State::c dr_type> p op; | 309 | typedef pop_segmen ts<typenam e State::c dr_type> p op; | |||
310 | typedef typename p op::type t ype; | 310 | typedef typename p op::type t ype; | |||
311 | 311 | |||||
312 | static t ype call(S tate const &state) | 312 | static t ype call(S tate const &state) | |||
313 | { | 313 | { | |||
314 | retu rn pop::ca ll(state.c dr); | 314 | retu rn pop::ca ll(state.c dr); | |||
315 | } | 315 | } | |||
316 | }; | 316 | }; | |||
317 | 317 | |||||
318 | te mplate<> | 318 | te mplate<> | |||
319 | struct pop_segmen ts<nil _t , true> | 319 |
struct
pop_segmen
ts<nil
|
|||
320 | { | 320 | { | |||
321 | typedef nil _t type; | 321 |
typedef
nil
|
|||
322 | 322 | |||||
323 | static type call(nil _t const &) | 323 |
static
type
call(nil
|
|||
324 | { | 324 | { | |||
325 | return nil _t (); | 325 |
return
nil
|
|||
326 | } | 326 | } | |||
327 | }; | 327 | }; | |||
328 | } // n amespace d etail | 328 | } // n amespace d etail | |||
329 | 329 | |||||
330 | struct segmented _iterator_ tag; | 330 | struct segmented _iterator_ tag; | |||
331 | 331 | |||||
332 | ////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// | 332 | ////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// | |||
333 | templa te<typenam e Cons> | 333 | templa te<typenam e Cons> | |||
334 | struct segmented _iterator | 334 | struct segmented _iterator | |||
335 | : fu sion::iter ator_base< segmented_ iterator<C ons> > | 335 | : fu sion::iter ator_base< segmented_ iterator<C ons> > | |||
336 | { | 336 | { | |||
337 | ty pedef segm ented_iter ator_tag f usion_tag; | 337 | ty pedef segm ented_iter ator_tag f usion_tag; | |||
338 | ty pedef fusi on::forwar d_traversa l_tag cate gory; | 338 | ty pedef fusi on::forwar d_traversa l_tag cate gory; | |||
339 | 339 | |||||
340 | ty pedef Cons cons_type ; | 340 | ty pedef Cons cons_type ; | |||
341 | ty pedef type name Cons: :car_type car_type; | 341 | ty pedef type name Cons: :car_type car_type; | |||
342 | ty pedef type name Cons: :cdr_type cdr_type; | 342 | ty pedef type name Cons: :cdr_type cdr_type; | |||
343 | 343 | |||||
344 | ex plicit seg mented_ite rator(Cons const &c) | 344 | ex plicit seg mented_ite rator(Cons const &c) | |||
345 | : cons_(c) | 345 | : cons_(c) | |||
346 | {} | 346 | {} | |||
347 | 347 | |||||
348 | co ns_type co nst &cons( ) const { return thi s->cons_; }; | 348 | co ns_type co nst &cons( ) const { return thi s->cons_; }; | |||
349 | ca r_type con st &car() const { re turn this- >cons_.car ; }; | 349 | ca r_type con st &car() const { re turn this- >cons_.car ; }; | |||
350 | cd r_type con st &cdr() const { re turn this- >cons_.cdr ; }; | 350 | cd r_type con st &cdr() const { re turn this- >cons_.cdr ; }; | |||
351 | 351 | |||||
352 | privat e: | 352 | privat e: | |||
353 | Co ns cons_; | 353 | Co ns cons_; | |||
354 | }; | 354 | }; | |||
355 | 355 | |||||
356 | ////// ////////// ////////// ////////// ////////// ////////// ////////// ///////// | 356 | ////// ////////// ////////// ////////// ////////// ////////// ////////// ///////// | |||
357 | templa te<typenam e Sequence > | 357 | templa te<typenam e Sequence > | |||
358 | struct segmented _begin | 358 | struct segmented _begin | |||
359 | { | 359 | { | |||
360 | ty pedef type name detai l::push_se gments<Seq uence> pus h; | 360 | ty pedef type name detai l::push_se gments<Seq uence> pus h; | |||
361 | ty pedef segm ented_iter ator<typen ame push:: type> type ; | 361 | ty pedef segm ented_iter ator<typen ame push:: type> type ; | |||
362 | 362 | |||||
363 | st atic type call(Seque nce &seq) | 363 | st atic type call(Seque nce &seq) | |||
364 | { | 364 | { | |||
365 | return type(push: :call(seq, nil _t ())); | 365 |
return
type(push:
:call(seq,
nil
|
|||
366 | } | 366 | } | |||
367 | }; | 367 | }; | |||
368 | 368 | |||||
369 | ////// ////////// ////////// ////////// ////////// ////////// ////////// ///////// | 369 | ////// ////////// ////////// ////////// ////////// ////////// ////////// ///////// | |||
370 | templa te<typenam e Sequence > | 370 | templa te<typenam e Sequence > | |||
371 | struct segmented _end | 371 | struct segmented _end | |||
372 | { | 372 | { | |||
373 | typedef segmented_ iterator<n il _t > type; | 373 |
typedef
segmented_
iterator<n
il
|
|||
374 | 374 | |||||
375 | st atic type call(Seque nce &) | 375 | st atic type call(Seque nce &) | |||
376 | { | 376 | { | |||
377 | return type(nil _t ()); | 377 |
return
type(nil
|
|||
378 | } | 378 | } | |||
379 | }; | 379 | }; | |||
380 | 380 | |||||
381 | namesp ace extens ion | 381 | namesp ace extens ion | |||
382 | { | 382 | { | |||
383 | te mplate<> | 383 | te mplate<> | |||
384 | st ruct value _of_impl<s egmented_i terator_ta g> | 384 | st ruct value _of_impl<s egmented_i terator_ta g> | |||
385 | { | 385 | { | |||
386 | template <typename Iterator> | 386 | template <typename Iterator> | |||
387 | struct a pply | 387 | struct a pply | |||
388 | { | 388 | { | |||
389 | type def typena me result_ of::begin< typename I terator::c ar_type>:: type begin ; | 389 | type def typena me result_ of::begin< typename I terator::c ar_type>:: type begin ; | |||
390 | type def typena me result_ of::value_ of<begin>: :type type ; | 390 | type def typena me result_ of::value_ of<begin>: :type type ; | |||
391 | }; | 391 | }; | |||
392 | }; | 392 | }; | |||
393 | 393 | |||||
394 | te mplate<> | 394 | te mplate<> | |||
395 | st ruct deref _impl<segm ented_iter ator_tag> | 395 | st ruct deref _impl<segm ented_iter ator_tag> | |||
396 | { | 396 | { | |||
397 | template <typename Iterator> | 397 | template <typename Iterator> | |||
398 | struct a pply | 398 | struct a pply | |||
399 | { | 399 | { | |||
400 | type def typena me result_ of::begin< typename I terator::c ar_type>:: type begin ; | 400 | type def typena me result_ of::begin< typename I terator::c ar_type>:: type begin ; | |||
401 | type def typena me result_ of::deref< begin>::ty pe type; | 401 | type def typena me result_ of::deref< begin>::ty pe type; | |||
402 | 402 | |||||
403 | stat ic type ca ll(Iterato r const &i t) | 403 | stat ic type ca ll(Iterato r const &i t) | |||
404 | { | 404 | { | |||
405 | return *fu sion::begi n(it.car() ); | 405 | return *fu sion::begi n(it.car() ); | |||
406 | } | 406 | } | |||
407 | }; | 407 | }; | |||
408 | }; | 408 | }; | |||
409 | 409 | |||||
410 | // discards the old he ad, expand s the righ t child of the new h ead | 410 | // discards the old he ad, expand s the righ t child of the new h ead | |||
411 | // and pushe s the resu lt to the head of th e list. | 411 | // and pushe s the resu lt to the head of th e list. | |||
412 | 412 | |||||
413 | te mplate<> | 413 | te mplate<> | |||
414 | st ruct next_ impl<segme nted_itera tor_tag> | 414 | st ruct next_ impl<segme nted_itera tor_tag> | |||
415 | { | 415 | { | |||
416 | template < | 416 | template < | |||
417 | type name Itera tor | 417 | type name Itera tor | |||
418 | , bool IsSegment Done = det ail::is_ra nge_next_e mpty<Itera tor>::valu e | 418 | , bool IsSegment Done = det ail::is_ra nge_next_e mpty<Itera tor>::valu e | |||
419 | > | 419 | > | |||
420 | struct a pply | 420 | struct a pply | |||
421 | { | 421 | { | |||
422 | type def typena me Iterato r::cdr_typ e cdr_type ; | 422 | type def typena me Iterato r::cdr_typ e cdr_type ; | |||
423 | type def detail ::range_ne xt<typenam e Iterator ::car_type > next; | 423 | type def detail ::range_ne xt<typenam e Iterator ::car_type > next; | |||
424 | type def segmen ted_iterat or<cons<ty pename nex t::type, c dr_type> > type; | 424 | type def segmen ted_iterat or<cons<ty pename nex t::type, c dr_type> > type; | |||
425 | 425 | |||||
426 | stat ic type ca ll(Iterato r const &i t) | 426 | stat ic type ca ll(Iterato r const &i t) | |||
427 | { | 427 | { | |||
428 | return typ e(fusion:: make_cons( next::call (it.car()) , it.cdr() )); | 428 | return typ e(fusion:: make_cons( next::call (it.car()) , it.cdr() )); | |||
429 | } | 429 | } | |||
430 | }; | 430 | }; | |||
431 | 431 | |||||
432 | template <typename Iterator> | 432 | template <typename Iterator> | |||
433 | struct a pply<Itera tor, true> // segmen t done, mo ve to next segment | 433 | struct a pply<Itera tor, true> // segmen t done, mo ve to next segment | |||
434 | { | 434 | { | |||
435 | type def typena me Iterato r::cdr_typ e cdr_type ; | 435 | type def typena me Iterato r::cdr_typ e cdr_type ; | |||
436 | type def typena me detail: :pop_segme nts<cdr_ty pe> pop; | 436 | type def typena me detail: :pop_segme nts<cdr_ty pe> pop; | |||
437 | type def segmen ted_iterat or<typenam e pop::typ e> type; | 437 | type def segmen ted_iterat or<typenam e pop::typ e> type; | |||
438 | 438 | |||||
439 | stat ic type ca ll(Iterato r const &i t) | 439 | stat ic type ca ll(Iterato r const &i t) | |||
440 | { | 440 | { | |||
441 | return typ e(pop::cal l(it.cdr() )); | 441 | return typ e(pop::cal l(it.cdr() )); | |||
442 | } | 442 | } | |||
443 | }; | 443 | }; | |||
444 | }; | 444 | }; | |||
445 | } | 445 | } | |||
446 | }} // name space boos t::fusion | 446 | }} // name space boos t::fusion | |||
447 | 447 | |||||
448 | #endif | 448 | #endif |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2007 Araxis Ltd (www.araxis.com). All rights reserved.