how to sort a queue?
Posted on 2006-11-13
i have a queue that consists of a number of user defined structs:
. // etc
i defined the queue as follows:
queue <people> group_q;
there are a certain amount of person instances of the people (people person1, person2, ..... etc) and some of these people have been added to the group_q queue.... now im wanting to pop certain elements out of the group_q based on certain attributes of the instances (ex. person1.age for example)
how do i sort a queue so that the highest/lowest age is at the head/front of the queue, so that when i pop the group_q, ill get the oldest/youngest person currently in the people_q queue?