261 |
261 |
262 static void cx_arl_reverse(struct cx_list_s *list) { |
262 static void cx_arl_reverse(struct cx_list_s *list) { |
263 |
263 |
264 } |
264 } |
265 |
265 |
|
266 static bool cx_arl_iter_valid(struct cx_iterator_s const *iter) { |
|
267 struct cx_list_s const *list = iter->src_handle; |
|
268 return iter->index < list->size; |
|
269 } |
|
270 |
|
271 static void *cx_arl_iter_current(struct cx_iterator_s const *iter) { |
|
272 return iter->elem_handle; |
|
273 } |
|
274 |
|
275 static void cx_arl_iter_next(struct cx_iterator_s *iter) { |
|
276 if (iter->remove) { |
|
277 iter->remove = false; |
|
278 cx_arl_remove(iter->src_handle, iter->index); |
|
279 } else { |
|
280 iter->index++; |
|
281 iter->elem_handle = cx_arl_at(iter->src_handle, iter->index); |
|
282 } |
|
283 } |
|
284 |
266 static struct cx_iterator_s cx_arl_iterator( |
285 static struct cx_iterator_s cx_arl_iterator( |
267 struct cx_list_s *list, |
286 struct cx_list_s *list, |
268 size_t index |
287 size_t index |
269 ) { |
288 ) { |
270 struct cx_iterator_s iter; |
289 struct cx_iterator_s iter; |
|
290 |
|
291 iter.index = index; |
|
292 iter.src_handle = list; |
|
293 iter.elem_handle = cx_arl_at(list, index); |
|
294 iter.valid = cx_arl_iter_valid; |
|
295 iter.current = cx_arl_iter_current; |
|
296 iter.next = cx_arl_iter_next; |
|
297 iter.remove = false; |
271 |
298 |
272 return iter; |
299 return iter; |
273 } |
300 } |
274 |
301 |
275 static cx_list_class cx_array_list_class = { |
302 static cx_list_class cx_array_list_class = { |