Namespaces
Variants

std::unordered_multiset<Key,Hash,KeyEqual,Allocator>:: empty

From cppreference.net

bool empty ( ) const noexcept ;
(C++11부터)
(C++26부터 constexpr)

컨테이너에 요소가 없는지 확인합니다.

목차

반환값

true 컨테이너가 비어 있는 경우, false 그렇지 않은 경우.

복잡도

상수.

예제

다음 코드는 empty 를 사용하여 std:: unordered_multiset < int > 가 요소를 포함하는지 확인합니다:

#include <iostream>
#include <unordered_set>
int main()
{
    std::unordered_multiset<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)