Quicksort or Priority queue

I am facing this problem very often. I produce some answers that i have to sort. What is best?
-making a priority queue where i push all the answers(and then pop them to print)
OR
-creating a list(or a vector which is better) and then using sort function from <algorithm>?
Thank you all
If you are going to add all the answers first, and then print the answers:
std::vector<> with std::sort()

If you are going add a few answers, then print those answers; add some more answers, then print the answers so far; etc...:
std::priority_queue<> and iterate over them (not pop) to print.

JLBorges wrote:
std::priority_queue<> and iterate over them (not pop) to print.

How do you iterate over std::priority_queue?
> How do you iterate over std::priority_queue?

Oh, I can't! - at least not in a portable way.

I was wrong; thanks Peter.

Topic archived. No new replies allowed.