#include
#include
#include
using namespace std;
class Thread {
int priority;
string name;
public:
Thread() {
name = "";
priority = 0;
}
Thread(string n, int p) {
name = n;
priority = p;
}
string getname() const {
return name;
}
int getpriority() const {
return priority;
}
};
// Determine priority.
bool operator<(const Thread &a, const Thread &b)
{
return a.getpriority() < b.getpriority();
}
int main()
{
priority_queue q;
q.push(Thread("F", 10));
q.push(Thread("M", 2));
// show priority
cout << "Priorities: ";
while(!q.empty()) {
cout << q.top().getname() << endl;
cout << " ";
q.pop();
}
return 0;
}