src/cx/list.h

changeset 474
9c1fccda16bc
parent 469
0458bff0b1cd
child 484
9e6900b1cf9d
equal deleted inserted replaced
473:1bd4b8c28722 474:9c1fccda16bc
82 * Member function for finding an element. 82 * Member function for finding an element.
83 */ 83 */
84 size_t (*find)(cx_list_s *list, void *elem); 84 size_t (*find)(cx_list_s *list, void *elem);
85 85
86 /** 86 /**
87 * Member function for retrieving the last element.
88 */
89 void *(*last)(cx_list_s *list);
90
91 /**
92 * Member function for sorting the list in place. 87 * Member function for sorting the list in place.
93 */ 88 */
94 void (*sort)(cx_list_s *list); 89 void (*sort)(cx_list_s *list);
95 } cx_list_class; 90 } cx_list_class;
96 91
198 static inline size_t cxListFind(CxList list, void *elem) { 193 static inline size_t cxListFind(CxList list, void *elem) {
199 return list->cl->find(list, elem); 194 return list->cl->find(list, elem);
200 } 195 }
201 196
202 /** 197 /**
203 * Returns a pointer to the last element of the list.
204 *
205 * This is effectively the same as cxListAt() with \c index=size-1, but
206 * this implementation may be more efficient depending on the list structure
207 * and the conrecte implementation of cxListAt().
208 *
209 * @param list the list
210 * @return a pointer to the last element or \c NULL if the list is empty
211 */
212 static inline void *cxListLast(CxList list) {
213 return list->cl->last(list);
214 }
215
216 /**
217 * Sorts the list in place. 198 * Sorts the list in place.
218 * 199 *
219 * \remark The underlying sort algorithm is implementation defined. 200 * \remark The underlying sort algorithm is implementation defined.
220 * 201 *
221 * @param list the list 202 * @param list the list

mercurial