I'm trying to convert this function to use a vector object instead of an integer array. The vector object looks like this:
std::vector<Heltal *> htal;
The Heltal class contains a private integer named heltal.
How would I sort the htal vector using the function below?
void Array::Sort(int a[], int first, int last)
{
int low = first;
int high = last;
int x = a[(first+last)/2];
do {
while(a[low] < x) {
low++;
}
while(a[high] > x) {
high--;
}
if(low<=high) {
std::swap(a[low],a[high]);
low++;
high--;
}
} while(low <= high);
if(first < high)
Array::Sort(a,first,high);
if(low < last)
Array::Sort(a,low,last);
}
Array::inArray::Sort(a,low,last);