I have a structure
struct dbdetails
{
int id;
string val;
};
I need a data structure in C++ that can hold structure variable with a sort capability. Is it possible? I was looking at vector, which can hold structure variable, but I will not be able to sort it based on id, because it is a structure member. Any suggestions?
You need a custom functor for comparing your tries. This should do the trick:
Please feel free to ask if you have any follow-up questions. Do you possess the Stroustrup book?
Edit: Suggestion of Matteo: