◐ Shell
clean mode source ↗

empty – cppreference.com

Z cppreference.com

<tbody> </tbody>

bool empty() const;

Funkce empty() vrací, jestli je zásobník prázdný.

Příklad

Spustit kód

stack<int> s;
for( int i = 0; i < 5; i++ )
{
   s.push(i);
}
while( !s.empty() )
{
   cout << s.top() << endl;
   s.pop();
}

Výstup:

5
4
3
2
1


Příbuzná témata: size