src/cx/iterator.h

changeset 858
d9ad7904c4c2
parent 854
fe0d69d72bcd
equal deleted inserted replaced
857:4d12e34bb130 858:d9ad7904c4c2
76 bool remove; 76 bool remove;
77 }; 77 };
78 78
79 /** 79 /**
80 * Declares base attributes for an iterator. 80 * Declares base attributes for an iterator.
81 * Must be the first member of an iterator structure.
81 */ 82 */
82 #define CX_ITERATOR_BASE struct cx_iterator_base_s base 83 #define CX_ITERATOR_BASE struct cx_iterator_base_s base
83 84
84 /** 85 /**
85 * Internal iterator struct - use CxIterator. 86 * Internal iterator struct - use CxIterator.
189 * Flags the current element for removal, if this iterator is mutating. 190 * Flags the current element for removal, if this iterator is mutating.
190 * 191 *
191 * @param iter the iterator 192 * @param iter the iterator
192 */ 193 */
193 #define cxIteratorFlagRemoval(iter) (iter).base.remove |= (iter).base.mutating 194 #define cxIteratorFlagRemoval(iter) (iter).base.remove |= (iter).base.mutating
195
196 /**
197 * Obtains a reference to an arbitrary iterator.
198 *
199 * This is useful for APIs that expect some iterator as an argument.
200 *
201 * @param iter the iterator
202 */
203 #define cxIteratorRef(iter) &((iter).base)
194 204
195 /** 205 /**
196 * Loops over an iterator. 206 * Loops over an iterator.
197 * @param type the type of the elements 207 * @param type the type of the elements
198 * @param elem the name of the iteration variable 208 * @param elem the name of the iteration variable

mercurial