ucx/cx/collection.h

changeset 113
dde28a806552
parent 112
c3f2f16fa4b8
equal deleted inserted replaced
112:c3f2f16fa4b8 113:dde28a806552
149 * 149 *
150 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE 150 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE
151 * @retval true if the elements are currently sorted wrt. the collection's compare function 151 * @retval true if the elements are currently sorted wrt. the collection's compare function
152 * @retval false if the order of elements is unknown 152 * @retval false if the order of elements is unknown
153 */ 153 */
154 #define cxCollectionSorted(c) ((c)->collection.sorted) 154 #define cxCollectionSorted(c) ((c)->collection.sorted || (c)->collection.size == 0)
155
156 /**
157 * Sets the compare function for a collection.
158 *
159 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE
160 * @param func (@c cx_compare_func) the compare function that shall be used by @c c
161 */
162 #define cxCollectionCompareFunc(c, func) (c)->collection.cmpfunc = (func)
155 163
156 /** 164 /**
157 * Sets a simple destructor function for this collection. 165 * Sets a simple destructor function for this collection.
158 * 166 *
159 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE 167 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE

mercurial