Template Class queue<T, Cont>

Synopsis

#include "boost/queue.hpp"

template <class T, class Cont = std::deque<T> >
class boost::queue
{
public:
  typedef typename Cont::value_type      value_type;
  typedef typename Cont::reference       reference;
  typedef typename Cont::const_reference const_reference;
  typedef typename Cont::size_type       size_type;
  typedef Cont                           container_type;
  typedef typename Cont::iterator        iterator;
  typedef typename Cont::const_iterator  const_iterator;

  explicit queue(Cont const& cont = Cont());

  bool              empty() const;
  size_type         size() const;
  void              push(value_type const& val);
  void              pop();
  value_type const& top() const;
  value_type&       top();
  value_type const& front() const;
  value_type&       front();
  value_type const& back() const;
  value_type&       back();

  iterator       begin();
  iterator       end();
  const_iterator begin();
  const_iterator end();
};
    

Description

The class queue is actually not really a priority queue in the normal sense. However, if you assume that the element which is stored the longest time in the queue has the largest priority, you can view this class as a priority queue: It provides access to the element which is stored the longest time in the queue (ie. queue has "first in, first out" semantics).

The class queue is a replacement for the standard class std::queue which provides an interface which is consistent with the other priority queue classes plus the interface of the standard class. If you only need functionality provided by the standard class and it doesn't matter that there is no top() function, then you can use the standard class as well.

For a description of the methods of queue<T, Cont> see the description of common methods or the documentation of the standard class std::queue.

See Also

heap(3), heap-common(3)
Copyright © 1999 Dietmar Kühl (dietmar.kuehl@claas-solutions.de)
Claas Solutions GmbH