list size() function in C++ STL
The list::size() is a built-in function in C++ STL which is used to find the number of elements present in a list container. That is, it is used to find the size of the list container.
Parameters: This function does not accept any parameter.
Return Value: This function returns the number of elements present in the list container list_name.
Below program illustrate the list::size() function in C++ STL:
size = demoList.size();
"The list contains "
<< size <<
Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.