std::flat_set<Key,Compare,KeyContainer>:: empty
|
(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 |
|
bool
empty
(
)
const
noexcept
;
|
(C++23 이후) | |
기본 컨테이너에 요소가 없는지 확인합니다. 다음 코드와 동일합니다: return begin ( ) == end ( ) ; .
목차 |
매개변수
(없음)
반환값
true 기본 컨테이너가 비어 있는 경우, false 그렇지 않은 경우.
복잡도
상수.
예제
다음 코드는
empty
를 사용하여
std::
flat_set
<
int
>
가 요소를 포함하는지 확인합니다:
#include <iostream> #include <flat_set> int main() { std::flat_set<int> numbers; std::cout << std::boolalpha; std::cout << "Initially, numbers.empty(): " << numbers.empty() << '\n'; numbers.insert(42); numbers.insert(19937); std::cout << "After adding elements, numbers.empty(): " << numbers.empty() << '\n'; }
출력:
Initially, numbers.empty(): true After adding elements, numbers.empty(): false
참고 항목
|
요소의 개수를 반환합니다
(public member function) |
|
|
(C++17)
|
컨테이너가 비어 있는지 확인합니다
(function template) |