docs/Writerside/topics/list.h.md

changeset 1244
9a8e781258ac
parent 1243
13e15cd529ae
equal deleted inserted replaced
1243:13e15cd529ae 1244:9a8e781258ac
324 This also automatically adds support for `CX_STORE_POINTERS` to your list. 324 This also automatically adds support for `CX_STORE_POINTERS` to your list.
325 325
326 ```C 326 ```C
327 // define the class with pointers to your functions 327 // define the class with pointers to your functions
328 static cx_list_class my_list_class = { 328 static cx_list_class my_list_class = {
329 my_list_destructor, 329 my_list_deallocate,
330 my_list_insert_element, 330 my_list_insert_element,
331 my_list_insert_array, 331 my_list_insert_array,
332 my_list_insert_sorted, 332 my_list_insert_sorted,
333 my_list_insert_iter, 333 my_list_insert_iter,
334 my_list_remove, 334 my_list_remove,
371 You can always look at the source code of the UCX implementations to get inspiration. 371 You can always look at the source code of the UCX implementations to get inspiration.
372 372
373 | Function | Description | 373 | Function | Description |
374 |------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 374 |------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
375 | `clear` | Invoke destructor functions on all elements and remove them from the list. | 375 | `clear` | Invoke destructor functions on all elements and remove them from the list. |
376 | `destructor` | Invoke destructor functions on all elements and deallocate the entire list memory. | 376 | `deallocate` | Invoke destructor functions on all elements and deallocate the entire list memory. |
377 | `insert_element` | Insert a single element at the specified index. Return zero on success and non-zero on failure. | 377 | `insert_element` | Insert a single element at the specified index. Return zero on success and non-zero on failure. |
378 | `insert_array` | Insert an array of elements starting at the specified index. Return the number of elements inserted. | 378 | `insert_array` | Insert an array of elements starting at the specified index. Return the number of elements inserted. |
379 | `insert_sorted` | Insert an array of sorted elements into a sorted list. Return the number of elements inserted. | 379 | `insert_sorted` | Insert an array of sorted elements into a sorted list. Return the number of elements inserted. |
380 | `insert_iter` | Insert a single element depending on the iterator position. The third argument to this function is zero when the element shall be inserted after the iterator position and non-zero if it shall be inserted before the iterator position. The implementation is also responsible for adjusting the iterator, respectively. | 380 | `insert_iter` | Insert a single element depending on the iterator position. The third argument to this function is zero when the element shall be inserted after the iterator position and non-zero if it shall be inserted before the iterator position. The implementation is also responsible for adjusting the iterator, respectively. |
381 | `remove` | Removes a multiple elements starting at the specified index. If a target buffer is specified, copy the elements to that buffer. Otherwise, invoke the destructor functions for the elements. Return the number of elements actually removed. | 381 | `remove` | Removes a multiple elements starting at the specified index. If a target buffer is specified, copy the elements to that buffer. Otherwise, invoke the destructor functions for the elements. Return the number of elements actually removed. |

mercurial