public member function
<stack>
std::stack::push
void push (const value_type& val);
void push (const value_type& val);void push (value_type&& val);
Insert element
This member function effectively calls the member function push_back of the underlying container object.
Parameters
- val
- Value to which the inserted element is initialized.
Member type value_type is the type of the elements in the container (defined as an alias of the first class template parameter, T).
Return value
noneExample
|
|
Output:
Popping out elements... 4 3 2 1 0
Complexity
One call to push_back on the underlying container.Data races
The container and up to all its contained elements are modified.Exception safety
Provides the same level of guarantees as the operation performed on the underlying container object.See also
- stack::pop
- Remove top element (public member function)
- stack::size
- Return size (public member function)