Hi guys,
If you have time, here's my question:
I'm trying to sort a 2D array A[m][2].
Just consider I have m nodes, A[i][0] is x-coordinate and A[i][1] is y-coordinate of Node i.
Basically, I'm sorting the "nodes" based on y-coordinate first, if they have the same y-coordinate then compare their x-coordinate.
The parameters to the predicate function should be what you would get if you dereference
the pointer/iterator that you passed to the sort function (so for example if you were
to dereference &A[0] you would get double[2]).
Arrays are at the heart of the problem you are having - (at least in msvc) - the sort algorithm tries to make a temporary variable of the contents of the current pointer.
As we said earlier, the contents of your pointer is an array of doubles - so trying to create this temporary variable is like saying:
1 2
int array1 [3];
int temp[3] = array1 //this type of array operation is illegal
Thank you very much, guestgulkan.
Do you think is there a way I can get around this and get the results I want?
If there isn't any easy solution to this,I guess I'll probably write my own sort().
Thanks a lot.