sort


Description:

[ CCode ( cname = "vala_g_ptr_array_sort" ) ]
public void sort (CompareFunc<G> compare_func)

Sorts the array, using compare_func

Example: Sort all items:

public static int main (string[] args) {
GenericArray<string> array = new GenericArray<string> ();
array.add ("second entry");
array.add ("third entry");
array.add ("first entry");

array.sort (strcmp);

// Output:
// ``first entry``
// ``second entry``
// ``third entry``
array.foreach ((str) => {
print ("%s\n", str);
});

return 0;
}

valac --pkg glib-2.0 GLib.GenericArray.sort.vala

Parameters:

compare_func

a comparison function, qsort-style, without a target