Original Post
I have a bunch of pointers in a priority_queue. They are threads in a scheduler. I can sort threads with a function that determines next execution time, by default however the priority queue will sort the threads based on their pointers memory address, not terribly useful
So I looked at the comparison function and couldn''t quite work out how to make it work. I kind of expected it to work the way a comparison function on std::sort() would work but I can''t seem to get it to work.
Assuming my comparison function looks like this(and it''s probably wrong)...
bool ThreadOrder (const CThread* a_First, const CThread* a_Second);
What does a constructor look like? I looks like that if I want to specify a comparison function I also need to specify the base container type.
Something like:
std:
riority_queue< , ThreadOrder> Threads;
Would anyone like to correct my code grammer or perhaps let me know where I''m going wrong?
Many thanks,
Chris Brodie
http:\\fourth.flipcode.com