help needed for priority queue using stl?

Write here if you have problems with your C source code

Moderator: Board moderators

Post Reply
harry
New poster
Posts: 20
Joined: Mon Aug 30, 2004 10:20 pm
Location: HK

help needed for priority queue using stl?

Post by harry » Fri Dec 31, 2004 8:49 pm

i want to insert two types of value in a proirity q using stl.

the problem is shown in the follwing example:

10 1
100 2
12 4
1000 3

so if i call q.top() then it will be 1000.
now i also want to get the position of 1000 which is 3.
how can i get it.
details information will be helpful.
thanks in advanced.

User avatar
shamim
A great helper
Posts: 498
Joined: Mon Dec 30, 2002 10:10 am
Location: Bozeman, Montana, USA

Post by shamim » Sat Jan 01, 2005 9:20 am

Use struct and define necessary functions which determines the sorting order of struct type.

For details look into http://www.sgi.com/tech/stl/

harry
New poster
Posts: 20
Joined: Mon Aug 30, 2004 10:20 pm
Location: HK

Post by harry » Sat Jan 01, 2005 10:28 am

thanks for the reply.
i have got the website.
but i could not find any help what i needed.
so i asked for help in the board.

can u explain how can i do that.
one thing i want to use priority queue

Post Reply

Return to “C”