Reputation: 201
Why priority queue have that signature ?
std::priority_queue<int, std::vector<int>, std::greater<int> > third;
For what need std::vector<int>
? If I, for example, need to store in queue only ints ?
Upvotes: 1
Views: 1668
Reputation: 71009
These are the template arguments for priority_queue
. The second one is the backing container used for storing the values and in this case you use vector (which is the default container). In the example above it is passed so that you can change the default comparison predicate with std::greater
(i.e. have a priority_queue
where the smallest value is at the top). Have a look at the class declaration here.
Upvotes: 2