In the line below vector is used in the parameter list
std::priority_queue<int, std::vector<int>, std::greater<int> >
The std::vector
is the underlying container used to implement the priority queue.
You can use any container type, given the following constrains (from http://en.cppreference.com/w/cpp/container/priority_queue ):
The container must satisfy the requirements of SequenceContainer, and its iterators must satisfy the requirements of RandomAccessIterator.
Additionally, it must provide the following functions with the usual semantics:
front()
push_back()
pop_back()
The standard containers std::vector and std::deque satisfy these requirements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.