Hi,
I want to use the stl priority_queue to store "Task's" sorted by the Task's priority. When I create a Task and put it in the queue I would like to be able to change the priority of the created task and thereafter I would like to sort the queue again.

struct Task
{
int priority;
friend bool operator < (const Task& t1, const Task& t2);
Task(int p=0) : priority(p) {}
};

bool operator < (const Task& t1, const Task& t2)
{
return t1.priority < t2.priority;
}

int main()
{
priority_queue<Task> scheduler;
Task a,b,c;
a.priority = 2;
scheduler.push(a);
scheduler.push(b);
scheduler.push(c);
a.priority = 0; // This Obviously dous not work but that
// is no suprise. How do I get to work?

while(!scheduler.empty())
{
cout << scheduler.top().priority << "\n";
scheduler.pop();
}
return 0;
}
Thanks