I am getting an invalid argument error (C++) in Eclipse version when trying to do a swap and I'm not sure how to resolve it. It seems like an IDE/config issue, here is the section of the code where I get the error:
'''
int partition(vector<Bid>& bids, int begin, int end) {
int low = begin;
int high = end;
//Choose the middle element as the pivot
int pivot = begin + (end - begin) /2;
bool done = false;
//While loops if not done
while (!done) {
//Increment low if less than pivot
while (bids.at(low).title.compare(bids.at(pivot).title) < 0) {
low++;
}
//Decrement high if less than pivot
while (bids.at(pivot).title.compare(bids.at(high).title) < 0) {
high--;
}
if (low >= high) {
done = true;
} else {
//Swap low and high bids
swap(bids.at(low), bids.at(high));
}
}
return high;
}
'''
Eclipse Neon.3 Release 4.6.3