std::stack<T,Container>::top (3) - Linux Manuals
std::stack<T,Container>::top: std::stack<T,Container>::top
NAME
std::stack<T,Container>::top - std::stack<T,Container>::top
Synopsis
reference top();
const_reference top() const;
Returns reference to the top element in the stack. This is the most recently pushed element. This element will be removed on a call to pop(). Effectively calls c.back().
Parameters
(none)
Return value
Reference to the last element
Complexity
Constant
Example
// Run this code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Output:
 
 
 
 
 See also
 
push (public member function)
 
pop  (public member function)