std::stack (3) - Linux Manuals
std::stack: std::stack
NAME
Synopsis
Defined in header <stack>
template<
class T,
class Container = std::deque<T>
> class stack;
The std::stack class is a container adapter that gives the programmer the functionality of a stack - specifically, a LIFO (last-in, first-out) data structure.
The class template acts as a wrapper to the underlying container - only a specific set of functions is provided. The stack pushes and pops the element from the back of the underlying container, known as the top of the stack.
Template parameters
T - The behavior is undefined if T is not the same type as Container::value_type.
Container - * push_back()
Member types
Member type Definition
container_type Container
value_type Container::value_type
size_type Container::size_type
reference Container::reference
const_reference Container::const_reference
Member functions
constructor (public member function)
destructor (public member function)
operator= (public member function)
Element access
top (public member function)
Capacity
empty (public member function)
size (public member function)
Modifiers
push (public member function)
emplace constructs element in-place at the top
(C++11)
pop (public member function)
swap (public member function)
Member objects
Container c (protected member object)
Non-member functions
operator==
operator!= lexicographically compares the values in the stack
operator< (function template)
operator<=
operator>
operator>=
std::swap(std::stack) (function template)
Helper classes
std::uses_allocator<std::stack> specializes the std::uses_allocator type trait