std::stack::stack

(1) explicit stack( const Container& cont = Container() ); (until C++11) explicit stack( const Container& cont ); (since C++11) explicit stack( Container&& cont = Container() ); (2) (since C++11) 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 A

std::stack::size

size_type size() const; Returns the number of elements in the underlying container, that is, c.size(). Parameters (none). Return value The number of elements in the container. Complexity Constant. See also empty checks whether the underlying container is empty (public member function)

std::stack::swap

void swap( stack& other ); (since C++11) Exchanges the contents of the container adaptor with those of other. Effectively calls using std::swap; swap(c, other.c); Parameters other - container adaptor to exchange the contents with Return value (none). Exceptions noexcept specification: noexcept(noexcept(std::swap(c, other.c))) Complexity Same as underlying container (typically constant). See also std::swap(std::stack) specializes the std::swap algorithm (

std::static_pointer_cast

template< class T, class U > std::shared_ptr<T> static_pointer_cast( const std::shared_ptr<U>& r ); (1) (since C++11) template< class T, class U > std::shared_ptr<T> dynamic_pointer_cast( const std::shared_ptr<U>& r ); (2) (since C++11) template< class T, class U > std::shared_ptr<T> const_pointer_cast( const std::shared_ptr<U>& r ); (3) (since C++11) Creates a new instance of std::shared_ptr whose managed

std::stack::top

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 #include <stack> #include <iostream> int main() { std::stack<int> s; s.push( 2 ); s.push( 6 ); s.push( 51 ); std::cou

std::stable_sort

Defined in header <algorithm> template< class RandomIt > void stable_sort( RandomIt first, RandomIt last ); (1) template< class RandomIt, class Compare > void stable_sort( RandomIt first, RandomIt last, Compare comp ); (2) Sorts the elements in the range [first, last) in ascending order. The order of equal elements is guaranteed to be preserved. The first version uses operator< to compare the elements, the second version uses the given comparison functi

std::stack::empty

bool empty() const; Checks if the underlying container has no elements, i.e. whether c.empty(). Parameters (none). Return value true if the underlying container is empty, false otherwise. Complexity Constant. See also size returns the number of elements (public member function)

std::stack::push

void push( const T& value ); void push( T&& value ); (since C++11) Pushes the given element value to the top of the stack. 1) Effectively calls c.push_back(value) 2) Effectively calls c.push_back(std::move(value)) Parameters value - the value of the element to push Return value (none). Complexity Equal to the complexity of Container::push_back. See also emplace (C++11) constructs element in-place at the top (public member function) pop

std::stack::emplace

template< class... Args > void emplace( Args&&... args ); (since C++11) Pushes new element on top of the stack. The element is constructed in-place, i.e. no copy or move operations are performed. The constructor of the element is called with exactly the same arguments as supplied to the function. Effectively calls c.emplace_back(std::forward<Args>(args)...). Parameters args - arguments to forward to the constructor of the element Return value (none).

std::stack::pop

void pop(); Removes the top element from the stack. Effectively calls c.pop_back(). Parameters (none). Return value (none). Complexity Equal to the complexity of Container::pop_back. See also emplace (C++11) constructs element in-place at the top (public member function) push inserts element at the top (public member function) top accesses the top element (public member function)