hi,
I need to partially sort a struct vector and I have written a function that looks like:
void AxisSort(int start, int end){
sort(prims.begin() + start, prims.begin() + end-start+1, compare);
}
"prims" here is a struct vector
The function works fine when start=0 and end=prims.size()-1
However, with other values the function simply stuck there as if entering an infinitive loop
I wonder if the sort function can only be used to sort the whole vector, but I cannot confirm if that is really the case.
Another choice is qsort, and it works. However, theoretically it is slower than sort. Does any one have better idea to partially sort a struct vector? Thanks.