std::stack<T,Container>:: size
From cppreference.net
|
size_type size
(
)
const
;
|
||
Gibt die Anzahl der Elemente im Container-Adapter zurück. Entspricht:
return
c
.
size
(
)
.
Inhaltsverzeichnis |
Parameter
(keine)
Rückgabewert
Die Anzahl der Elemente im Container-Adapter.
Komplexität
Konstante.
Beispiel
Diesen Code ausführen
#include <cassert> #include <stack> int main() { std::stack<int> stack; assert(stack.size() == 0); const int count = 8; for (int i = 0; i != count; ++i) stack.push(i); assert(stack.size() == count); }
Siehe auch
|
prüft, ob der Container-Adapter leer ist
(öffentliche Elementfunktion) |
|
|
(C++17)
(C++20)
|
gibt die Größe eines Containers oder Arrays zurück
(Funktionstemplate) |