After working on it a bit last night, googling lists, sorting, and pointers and every combination there of I was able to get it to work. However, im not sure I understand what is going on so if somone can explain it I would appreciate it. I want to both be able to understand and implement it.
Within my class that manages (builds, populates and manipulates) my list object I built a boolean function object (I think), that is later passed into the list.sort() function. Here's what I added...
CODE
struct SortProcess : public std::binary_function<LineObject*, LineObject*, bool>
{
bool operator()(LineObject* left, LineObject *right) const
{
if(left->get_carValue() < right->get_carValue())
return true;
else if(left->get_carValue() == right->get_carValue())
{
if(left->get_driverName() < right->get_driverName())
return true;
else
return false;
}
else
return false;
}
};
Then later, when I called list.sort all I had to do was pass it SortProcess
CODE
.
.
mylist.sort(SortProcess);
.
.
I hope im explaining it right....