std::stack<T,Container>:: empty
From cppreference.net
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::stack
| Member functions | ||||
| Element access | ||||
| Capacity | ||||
|
stack::empty
|
||||
| Modifiers | ||||
|
(C++23)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Non-member functions | ||||
|
(C++11)
|
||||
| Helper classes | ||||
|
(C++11)
|
||||
|
(C++23)
|
||||
| Deduction guides (C++17) |
|
bool
empty
(
)
const
;
|
||
기본 컨테이너에 요소가 없는지 확인합니다. 다음과 동일합니다:
return
c
.
empty
(
)
.
목차 |
매개변수
(없음)
반환값
true 기본 컨테이너가 비어 있는 경우, false 그렇지 않은 경우.
복잡도
상수.
예제
이 코드 실행
#include <cassert> #include <stack> int main() { std::stack<int> stack; assert(stack.empty()); stack.push(42); assert(!stack.empty()); stack.pop(); assert(stack.empty()); }
참고 항목
|
요소의 개수를 반환합니다
(public member function) |
|
|
(C++17)
|
컨테이너가 비어 있는지 확인합니다
(function template) |