Dear All,
I'm trying to sort a list of structs using STL library.
struct myStruct {
int i;
string s;
};
bool compare(int first, int second)
{
if (first < second)
return true;
else
return false;
}
int main()
{
list<myStruct> myList;
/* Pretend that myList has elements with values */
myList.sort(compare); // How could this be done!!!
/* I need to sort based on int i */
}