src/cx/array_list.h

changeset 1621
c52a4c67e29e
parent 1620
bf5d647f939d
child 1622
27e7a4bf1a39
--- a/src/cx/array_list.h	Thu Dec 18 12:11:30 2025 +0100
+++ b/src/cx/array_list.h	Thu Dec 18 12:26:25 2025 +0100
@@ -560,6 +560,51 @@
         cx_compare_func2 fn, void *context);
 
 /**
+ * Sorts an array.
+ *
+ * Internal function - do not use.
+ *
+ * @param array a pointer to the array structure
+ * @param elem_size the size of one element
+ * @param fn the compare function
+ */
+CX_EXPORT void cx_array_sort_(CxArray *array, size_t elem_size,
+        cx_compare_func fn);
+
+/**
+ * Sorts an array.
+ *
+ * Internal function - do not use.
+ *
+ * @param array a pointer to the array structure
+ * @param elem_size the size of one element
+ * @param fn the compare function
+ * @param context the context for the compare function
+ */
+CX_EXPORT void cx_array_sort_c_(CxArray *array, size_t elem_size,
+        cx_compare_func2 fn, void *context);
+
+/**
+ * Sorts an array.
+ *
+ * @param array the name of the array
+ * @param fn (@c cx_compare_func) the compare function
+ * @param context (@c void*) the context for the compare function
+ */
+#define cx_array_sort(array, fn) \
+        cx_array_sort_((CxArray*)&(array), sizeof((array).data[0]), fn)
+
+/**
+ * Sorts an array.
+ *
+ * @param array the name of the array
+ * @param fn (@c cx_compare_func2) the compare function
+ * @param context (@c void*) the context for the compare function
+ */
+#define cx_array_sort_c(array, fn, context) \
+        cx_array_sort_c_((CxArray*)&(array), sizeof((array).data[0]), fn, context)
+
+/**
  * Creates an iterator over the elements of an array.
  *
  * Internal function - do not use.

mercurial