// ------------------------------------------------------------------------ // Priority queues: derived from Container-<--Linear-<--PQueue // A. Fischer June 9, 2001 file: pqueue.hpp // ------------------------------------------------------------------------ #pragma once #include "ordered.hpp" #include "linear.hpp" template class PQueue : public Linear { public: // ----------------------------------------------------- PQueue(){} ~PQueue(){} void focus(){ Linear::reset(); } // Priority queue deletion is at the head. protected: // ------------------------ Insert new Cell in ascending sorted order. void insert( Cell* cp ) { for (Linear::reset(); !Linear::end(); ++*this) { // locate insertion spot. const T* thisItem = *this; // the current item in the Linear if (*thisItem < *getData( cp )) break; } Linear::insert( cp ); // do the insertion. } };