std::list::size
cppreference.com
[] |
Google. . , . , . |
<metanoindex/>
<tbody> </tbody> size_type size() const; |
||
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
()
noexcept:
noexceptConstant or linear ( C++11)
Constant ( C++11)
The following code uses size to display the number of elements in a std::list<int>:
#include <list>
#include <iostream>
int main()
{
std::list<int> nums {1, 3, 5, 7};
std::cout << "nums contains " << nums.size() << " elements.\n";
}
:
nums contains 4 elements.
.
| , (public -) | |
| (public -) | |
| (public -) |