36 } |
36 } |
37 |
37 |
38 static void *cx_iter_current(const void *it) { |
38 static void *cx_iter_current(const void *it) { |
39 const struct cx_iterator_s *iter = it; |
39 const struct cx_iterator_s *iter = it; |
40 return iter->elem_handle; |
40 return iter->elem_handle; |
|
41 } |
|
42 |
|
43 static void *cx_iter_current_ptr(const void *it) { |
|
44 const struct cx_iterator_s *iter = it; |
|
45 return *(void**)iter->elem_handle; |
41 } |
46 } |
42 |
47 |
43 static void cx_iter_next_fast(void *it) { |
48 static void cx_iter_next_fast(void *it) { |
44 struct cx_iterator_s *iter = it; |
49 struct cx_iterator_s *iter = it; |
45 if (iter->base.remove) { |
50 if (iter->base.remove) { |
108 ) { |
113 ) { |
109 CxIterator iter = cxMutIterator((void*)array, elem_size, elem_count, false); |
114 CxIterator iter = cxMutIterator((void*)array, elem_size, elem_count, false); |
110 iter.base.mutating = false; |
115 iter.base.mutating = false; |
111 return iter; |
116 return iter; |
112 } |
117 } |
|
118 |
|
119 CxIterator cxMutIteratorPtr( |
|
120 void *array, |
|
121 size_t elem_count, |
|
122 bool remove_keeps_order |
|
123 ) { |
|
124 CxIterator iter = cxMutIterator(array, sizeof(void*), elem_count, remove_keeps_order); |
|
125 iter.base.current = cx_iter_current_ptr; |
|
126 return iter; |
|
127 } |
|
128 |
|
129 CxIterator cxIteratorPtr( |
|
130 const void *array, |
|
131 size_t elem_count |
|
132 ) { |
|
133 CxIterator iter = cxMutIteratorPtr((void*) array, elem_count, false); |
|
134 iter.base.mutating = false; |
|
135 return iter; |
|
136 } |