You are on page 1of 2

std::queue

std::stack

Example

Example

Operations Summary

Operations Summary

Member type

Denition

container_type

Container

Member type

Denition

value_type

Container::value_type

container_type

Container

size_type

Container::size_type

value_type

Container::value_type

reference

Container::reference

size_type

Container::size_type

reference

Container::reference

const_reference Container::const_reference
(constructor)
(destructor)
operator=

const_reference Container::const_reference

constructs the queue


(public member function)

(constructor)

destructs the queue


(public member function)

assigns values to the container adaptor


(public member function)

(destructor)
operator=

constructs the stack


(public member function)

destructs the stack


(public member function)

assigns values to the container adaptor


(public member function)

Element access
Element access

access the rst element

front

(public member function)

accesses the top element

top

access the last element

back

(public member function)

(public member function)

Capacity
Capacity

checks whether the underlying container is empty

empty

(public member function)

(public member function)

returns the number of elements

size

returns the number of elements

size

checks whether the underlying container is empty

empty

(public member function)

(public member function)

Modiers
Modiers

(public member function)

constructs element in-place at the end


emplace (C++11) (public member function)
removes the rst element

pop

(public member function)

removes the top element

pop

(public member function)

swaps the contents


(public member function)

(public member function)

Member objects

Member objects
Container

(public member function)

constructs element in-place at the top


emplace (C++11) (public member function)

swap

swaps the contents

swap

inserts element at the top

push

inserts element at the end

push

operator==
operator!=
operator<
operator<=
operator>
operator>=

Container

the underlying container


(protected member object)

lexicographically compares the values in the queue


(function template)

specializes the std::swapalgorithm


std::swap(std::queue) (function template)
specializes the std::uses_allocatortype trait
std::uses_allocator<std::queue> (C++11) (function template)

operator==
operator!=
operator<
operator<=
operator>
operator>=

the underlying container


(protected member object)

lexicographically compares the values in the stack


(function template)

specializes the std::swapalgorithm


std::swap(std::stack) (function template)
specializes the std::uses_allocatortype trait
std::uses_allocator<std::stack> (C++11) (function template)

Operations details

Operations details

bool empty() const;


queue operator=( const queue& other );

(1)

queue operator=( queue&& other );

(2)

(since C++11)

void pop();

void push( const value_type& value );

~queue();

void push( value_type&& value );

(since C++11)

bool empty() const;


void pop();
size_type size() const;
void swap( queue& other );

(since C++11)

reference front();
const_reference front() const;
template< class... Args >
void emplace( Args&&... args );

(since C++11)
(until C++17)

template< class... Args >


reference emplace( Args&&... args );

(since C++17)

template< class T, class Container >


void swap( queue<T,Container>& lhs,
queue<T,Container>& rhs );

template< class T, class Container >


bool operator==( stack<T,Container>& lhs,
stack<T,Container>& rhs );

(1)

template< class T, class Container >


bool operator!=( stack<T,Container>& lhs,
stack<T,Container>& rhs );

(2)

template< class T, class Container >


bool operator<( stack<T,Container>& lhs,
stack<T,Container>& rhs );

(3)

template< class T, class Container >


bool operator<=( stack<T,Container>& lhs,
stack<T,Container>& rhs );

(4)

template< class T, class Container >


bool operator>( stack<T,Container>& lhs,
stack<T,Container>& rhs );

(5)

template< class T, class Container >


bool operator>=( stack<T,Container>& lhs,
stack<T,Container>& rhs );

(6)

template< class T, class Container, class Alloc >


struct uses_allocator<stack<T,Container>,Alloc> :
std::uses_allocator<Container, Alloc>::type { };

reference back();
const_reference back() const;
template< class T, class Container >
bool operator==( queue<T,Container>& lhs,
queue<T,Container>& rhs );

stack operator=( const stack& other );

(1)

(1)

stack operator=( stack&& other );

(2)

template< class T, class Container >


bool operator!=( queue<T,Container>& lhs,
queue<T,Container>& rhs );

(2)

template< class T, class Container >


void swap( stack<T,Container>& lhs,
stack<T,Container>& rhs );

template< class T, class Container >


bool operator<( queue<T,Container>& lhs,
queue<T,Container>& rhs );

(3)

reference top();

template< class T, class Container >


bool operator<=( queue<T,Container>& lhs,
queue<T,Container>& rhs );

(4)

void swap( stack& other );

template< class T, class Container >


bool operator>( queue<T,Container>& lhs,
queue<T,Container>& rhs );

(5)

template< class... Args >


void emplace( Args&&... args );

(since C++11)
(until C++17)

template< class T, class Container >


bool operator>=( queue<T,Container>& lhs,
queue<T,Container>& rhs );

template< class... Args >


reference emplace( Args&&... args );

(since C++17)

(6)

(since C++11)

const_reference top() const;

(since C++11)

template< class T, class Container, class Alloc >


struct uses_allocator<queue<T,Container>,Alloc> :
std::uses_allocator<Container, Alloc>::type { };

(since C++11)

size_type size() const;

void push( const value_type& value );


void push( value_type&& value );

(since C++11)

(since C++11)

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


explicit queue( const Container& cont );

(1)

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

(2)

queue( const queue& other );

(3)

queue( queue&& other );

(4)

(until C++11)
(since C++11)
(since C++11)

(since C++11)

explicit stack( const Container& cont = Container() );


explicit stack( const Container& cont );

(1)

explicit stack( Container&& cont = Container() );

(2)

stack( const stack& other );

(3)

stack( stack&& other );

(4)

(since C++11)

template< class Alloc >


explicit stack( const Alloc& alloc );

(5)

(since C++11)

template< class Alloc >


stack( const Container& cont, const Alloc& alloc );

(6)

(since C++11)

template< class Alloc >


stack( Container&& cont, const Alloc& alloc );

(7)

(since C++11)

(8)

(since C++11)

(9)

(since C++11)

template< class Alloc >


explicit queue( const Alloc& alloc );

(5)

(since C++11)

template< class Alloc >


stack( const stack& other, const Alloc& alloc );

template< class Alloc >


queue( const Container& cont, const Alloc& alloc );

(6)

(since C++11)

template< class Alloc >


stack( stack&& other, const Alloc& alloc );

template< class Alloc >


queue( Container&& cont, const Alloc& alloc );

(7)

(since C++11)

template< class Alloc >


queue( const queue& other, const Alloc& alloc );

(8)

(since C++11)

template< class Alloc >


queue( queue&& other, const Alloc& alloc );

(9)

(since C++11)

~stack();

(until C++11)
(since C++11)
(since C++11)

You might also like