public member function
<set>
std::set::sizesize_type size() const noexcept;
Return container size
Returns the number of elements in the set container.Member type size_type is an unsigned integral type.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// set::size
#include <iostream>
#include <set>
int main ()
{
std::set<int> myints;
std::cout << "0. size: " << myints.size() << '\n';
for (int i=0; i<10; ++i) myints.insert(i);
std::cout << "1. size: " << myints.size() << '\n';
myints.insert (100);
std::cout << "2. size: " << myints.size() << '\n';
myints.erase(5);
std::cout << "3. size: " << myints.size() << '\n';
return 0;
}
0. size: 0 1. size: 10 2. size: 11 3. size: 10
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4