Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

queue

Library:  Containers


Does not inherit

Local Index

Members

Non-Members

Summary

A container adaptor that behaves like a queue (first in, first out)

Synopsis

#include <queue>

namespace std {
  template <class T, class Container = deque<T> > 
  class queue;
}

Description

The queue container adaptor lets a container act as a queue. In a queue, items are pushed into the back of the container and removed from the front. The first items pushed into the queue are the first items to be popped off of the queue (first in, first out, or FIFO).

queue can adapt any container that supports the front(), back(), push_back(), and pop_front() operations. In particular, deque and list can be used.

Interface

Constructors

explicit queue(const Container& = Container());

Member Functions

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

Nonmember Operators

template <class T, class Container>
  bool operator==(const queue<T, Container>& x,
                   const queue<T, Container>& y);
template <class T, class Container>
  bool operator!=(const queue<T, Container>& x,
                   const queue<T, Container>& y);
template <class T, class Container>
  bool operator<(const queue<T, Container>& x,
                  const queue<T, Container>& y);
template <class T, class Container>
  bool operator>(const queue<T, Container>& x,
                  const queue<T, Container>& y);
template <class T, class Container>
  bool operator<(const queue<T, Container>& x,
                  const queue<T, Container>& y);
template <class T, class Container>
  bool operator<(const queue<T, Container>& x,
                  const queue<T, Container>& y);

Example

See Also

allocator, Containers, priority_queue

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 23.2.3.1



Previous fileTop of DocumentContentsIndex pageNext file