src/cx/list.h

changeset 638
eafb45eefc51
parent 630
ac5e7f789048
child 640
55cc3b373c5e
equal deleted inserted replaced
637:ceadf0792ded 638:eafb45eefc51
146 size_t index, 146 size_t index,
147 void const *elem 147 void const *elem
148 ); 148 );
149 149
150 /** 150 /**
151 * Member function for inserting multiple elements.
152 */
153 size_t (*insert_array)(
154 struct cx_list_s *list,
155 size_t index,
156 void const *data,
157 size_t n
158 );
159
160 /**
151 * Member function for inserting an element relative to an iterator position. 161 * Member function for inserting an element relative to an iterator position.
152 */ 162 */
153 int (*insert_iter)( 163 int (*insert_iter)(
154 struct cx_mut_iterator_s *iter, 164 struct cx_mut_iterator_s *iter,
155 void const *elem, 165 void const *elem,
279 ) { 289 ) {
280 return list->cl->insert(list, index, elem); 290 return list->cl->insert(list, index, elem);
281 } 291 }
282 292
283 /** 293 /**
294 * Inserts multiple items to the list at the specified index.
295 * If \p index equals the list size, this is effectively cxListAddArray().
296 *
297 * This method is usually more efficient than invoking cxListInsert()
298 * multiple times.
299 *
300 * If there is not enough memory to add all elements, the returned value is
301 * less than \p n.
302 *
303 * @param list the list
304 * @param index the index where to add the elements
305 * @param array a pointer to the elements to add
306 * @param n the number of elements to add
307 * @return the number of added elements
308 */
309 __attribute__((__nonnull__))
310 static inline size_t cxListInsertArray(
311 CxList *list,
312 size_t index,
313 void const *array,
314 size_t n
315 ) {
316 return list->cl->insert_array(list, index, array, n);
317 }
318
319 /**
284 * Inserts an element after the current location of the specified iterator. 320 * Inserts an element after the current location of the specified iterator.
285 * 321 *
286 * The used iterator remains operational, but all other active iterators should 322 * The used iterator remains operational, but all other active iterators should
287 * be considered invalidated. 323 * be considered invalidated.
288 * 324 *

mercurial