//: C07:PriorityQueue4.cpp // From "Thinking in C++, Volume 2", by Bruce Eckel & Chuck Allison. // (c) 1995-2004 MindView, Inc. All Rights Reserved. // See source code use permissions stated in the file 'License.txt', // distributed with the code package available at www.MindView.net. // Manipulating the underlying implementation. #include #include #include #include #include #include using namespace std; class PQI : public priority_queue { public: vector& impl() { return c; } }; int main() { PQI pqi; srand(time(0)); for(int i = 0; i < 100; i++) pqi.push(rand() % 25); copy(pqi.impl().begin(), pqi.impl().end(), ostream_iterator(cout, " ")); cout << endl; while(!pqi.empty()) { cout << pqi.top() << ' '; pqi.pop(); } } ///:~