I am trying to implement quick sort with the median of three as my pivot. My list is of key value pairs, I am trying to save the middle key in order to compare it with the first and last, however,whenever I get my iterator to the middle of the list, I get an error.
This is how I am declaring my typename/typedef for reference
This is the piece of code I am getting the error on
1 2 3 4 5 6
it itPos = quickList.begin();
std::advance(itPos, quickList.size() / 2);
K mid = (*itPos).key();
K front = (*quickList.begin()).key();
K back = (*quickList.end()).key();
K p;
quickList is a List object
I receive the error immediately after the std::advance line. I am not sure why I am getting this error, when looking at the locals, I am at the correct position in the list, but I am not sure why I get the error. Any suggestions as to what is going wrong?