Size
Let's find out how we can check the size and capacity of our container.
For a container cont
, you can check with cont.empty()
if the container is empty. cont.size()
returns the current number of elements, and cont.max_size()
returns the maximum number of elements cont
can have. The maximum number of elements is implementation defined.
Get hands-on with 1400+ tech skills courses.