Code Fragment: SSPQ1



template <typename Key, typename Element, typename Comp>
class SortedSeqPriorityQueue { 
protected:      					// typename shortcuts
  typedef Item<Key, Element>	    Item;		// (key, element) pair
  typedef NodeSequence<Item>	    Sequence;		// a sequence of items
public:
  typedef Sequence::Position 	    Position;		// position in sequence
protected:      					// local utilities
  const Key& key(const Position& p) const 		// position's key
    { return p.element().key(); }
  Element& element(const Position& p)			// position's element
    { Position t = p; return t.element().element(); }
private:        					// member data
  Sequence  S;						// sorted sequence
  Comp	    comp;					// comparator
public:
  SortedSeqPriorityQueue() : S(), comp() { }		// default constructor
  int size() const      				// number of items
    { return S.size(); }
  bool isEmpty() const  				// is the queue empty?
    { return S.isEmpty(); }
  // ...