unordered_map_empty
unordered_map_empty (std::unordered_map::empty — 비어 있는지 확인)
std::unordered_map에 원소가 없는지 확인하는 멤버 함수예요.
출처: cppreference
본문
시그니처는 다음과 같아요.
bool empty() const noexcept;
컨테이너에 원소가 없는지, 즉 begin() == end()인지 확인해요.
반환값
컨테이너가 비어 있으면 true, 아니면 false.
복잡도
상수(constant)예요.
예제
#include <iostream>
#include <unordered_map>
int main()
{
std::unordered_map<int, int> numbers;
std::cout << std::boolalpha << numbers.empty() << '\n'; // true
numbers.emplace(1, 10);
std::cout << numbers.empty() << '\n'; // false
}