Namespaces
Variants

std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>:: empty

From cppreference.net

bool empty ( ) const noexcept ;
(C++23 이후)

기본 컨테이너에 요소가 없는지 확인합니다. 다음 코드와 동일합니다: return begin ( ) == end ( ) ; .

목차

매개변수

(없음)

반환값

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

복잡도

상수.

예제

다음 코드는 empty 를 사용하여 std:: flat_multimap < int , int > 에 요소가 있는지 확인합니다:

#include <iostream>
#include <flat_map>
#include <utility>
int main()
{
    std::flat_multimap<int,int> numbers;
    std::cout << std::boolalpha;
    std::cout << "Initially, numbers.empty(): " << numbers.empty() << '\n';
    numbers.emplace(42, 13);
    numbers.insert(std::make_pair(13317, 123));
    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)