I am trying to convert a min-heap priority queue to return as a vector of ints. Is this type conversion is possible in C++;
The C++ std::priority_queue uses a container for storage https://en.cppreference.com/w/cpp/container/priority_queue
By default it is class Container = std::vector<T>
Is this what you want to get access to? If so, though luck:
C, the underlying container (protected member object)
It is not exposed. You could derive from priority_queue and expose it, if needed. But you post is thin as to what you are actually trying to do.
Keep in mind that:
This answer discusses accessing the Container: Is there a way to access the underlying container of STL container adaptors?
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.