public member function
<stack>
std::stack::size
Return size
This member function effectively calls member size of the underlying container object.
Parameters
noneReturn Value
The number of elements in the underlying container.Member type size_type is an unsigned integral type.
Example
|
|
Output:
0. size: 0 1. size: 5 2. size: 4
Complexity
Constant (calling size on the underlying container).Data races
The container is accessed.Exception safety
Provides the same level of guarantees as the operation performed on the container (no-throw guarantee for standard container types).See also
- stack::empty
- Test whether container is empty (public member function)