STL list::sort() sorting structs
I've got some code as follows:
Code:
struct Sector
{
string strName;
long lPosition;
}
list<Sector> lstSector;
I want to be able to use the list::sort() member function to sort the list by the strName member but I don't know enough about STL to do this. If I create a list<string> linked-list I can simply call the list::sort function without parameters and it will know how to sort by using the string comparison operators. However, since I'm using a struct in the linked-list I think I need to create a predicate or something to pass as a parameter. Anyone experienced enough with this to help me out?
Also, I am intrigued by everything in the STL that I may be missing out on. I'm thinking of buying a C++ Standard Library book by Nicolai Josuttis(?). Does anyone have this book and can they tell me if its good?