Sorting 2D array with custom compare function


There are examples of sorting vectors or dynamically allocated arrays but I couldn't find any help regarding static arrays. Let's say I have an array

int array[10][10];

and a compare function,

bool compare(const int (*a)[10], const int (*b)[10]);

When I call it like this,

std::sort(array, array + 10, compare);

I have compilation errors: error: cannot convert 'int*' to 'const int (*)[10]' in argument passing

I tried many ways, casting array to (void**) in sort function but then I have segmentation fault. My problem is using arrays as function parameters I guess but I couldn't figure out how to use this std::sort. Otherwise, I will have to write my own sort function. Thanks in advance!
Topic archived. No new replies allowed.