| | | | | |
template <typename T, class Container>
class Queue
{
protected:
  Container c_;

public:
  typedef T ValueType;
  // assumption: T and Container::ValueType are the same type

  void         Push  (const ValueType& t)  { c_.PushBack(t);    }
  void         Pop   ()                    { c_.PopFront();     }  // Precondition: !Empty() 
  ValueType&   Front ()                    { return c_.Front(); }  // Precondition: !Empty()
  bool         Empty () const              { return c_.Empty(); }
  unsigned int Size  () const              { return c_.Size();  }
  void         Clear ()                    { c_.Clear(); }
} ;

| | Top of Page | 5. Abstract Data Types: Stacks and Queues - 20 of 22