size
Z cppreference.com
< cpp | container/stack
<tbody>
</tbody>
size_type size() const; |
||
Funkce size() vrací počet prvků v zásobníku.
Příklad
Spustit kód
stack<int> s;
for( int i = 0; i < 5; i++ )
{
s.push(i);
}
while( s.size() != 0 )
{
cout << s.top() << endl;
s.pop();
}
Výstup:
5
4
3
2
1
Příbuzná témata: empty