so I'm trying to sort a list of lists. Inside of each sublist the elements are classes that contains a runtime. This is the integer variable I am using to sort my list.
However, the list will not 100% sort itself if the smallest runtime is at the end of the list. I have a attached an image below of the terminal output for visualization.
Here is the code:
void sort( list<list<MetaData> > &omegaList )
{
// variables
list<list<MetaData> >::iterator cursor = omegaList.begin();
list<list<MetaData> >::iterator ptr = omegaList.begin();
list<list<MetaData> >::iterator end = omegaList.end();
// start the bubble sort...
for(; cursor != end; cursor++)
{
// iterate through the list
for(; ptr != end; ptr++)
{
// compare runtimes of different lists
if( ptr->front().getProcessRunTime() < cursor->front().getProcessRunTime() )
{
// swap locations of lists in omegaList
swap( *ptr, *cursor );
// reset
cursor = ptr = omegaList.begin();
}
}
}
}
If anybody could please explain to me WHY it won't look at the very last element and then tell me how to fix it I would appreciate it.

std::sort?