Priority_queue question

Hello,

I have seen this single line code priority_queue <int, vector<int>, greater<int> > pq; which inserts integers into the queue and the lowest integer the highest priority.

I want to drive this idea, but instead of using 'int', I want to use a class called
1
2
3
4
5
6
class Job
{
	private:
		int ticks;	// represents how long the job takes to process

};


so the priority becomes as: the lowest ticks the job has, the highest priority it becomes.
I tried to do this priority_queue <Job, vector<Job>, greater<Job> > pq; but didn't work, and I tried to overload the operator > but I couldn't figure out how to do this.

Please help me with this!
Does my question make any sense?
This site's tutorial actually has a section on operator overloading which should help you out:
http://cplusplus.com/doc/tutorial/classes2/
Post again if you have questions after reading that.
Topic archived. No new replies allowed.