FreeBSD Manual Pages
std::stack::size(3) C++ Standard Libary std::stack::size(3) NAME std::stack::size - std::stack::size Synopsis 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. Example // Run this code #include <algorithm> #include <iostream> #include <stack> int main() { std::stack<int> container; std::cout << "Initially, container.size(): " << container.size() << '\n'; for (int i = 0; i < 7; ++i) container.push(i); std::cout << "After adding elements, container.size(): " << con- tainer.size() << '\n'; } Output: Initially, container.size(): 0 After adding elements, container.size(): 7 See also empty checks whether the underlying container is empty (public member function) http://cppreference.com 2022.07.31 std::stack::size(3)
NAME | Synopsis | Parameters | Return value | Complexity | Example | Output: | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::stack::size&sektion=3&manpath=FreeBSD+Ports+15.0>
