time_zone_operator_cmp
time_zone_operator_cmp (time_zone 비교 연산)
std::chrono::time_zone에 대한 비교 연산자예요. 두 시간대를 이름 기준으로 비교해요.
출처: cppreference
본문
std::chrono::time_zone의 비교 연산자는 <chrono> 헤더에 정의되어 있어요. C++20부터 사용 가능해요.
constexpr bool operator==( const std::chrono::time_zone& x,
const std::chrono::time_zone& y ) noexcept;
constexpr std::strong_ordering operator<=>( const std::chrono::time_zone& x,
const std::chrono::time_zone& y ) noexcept;
두 std::chrono::time_zone x와 y를 이름(name()) 기준으로 비교해요.
예제 (Example)
#include <chrono>
#include <iostream>
int main()
{
auto a = std::chrono::locate_zone("Asia/Seoul");
auto b = std::chrono::locate_zone("UTC");
std::cout << (*a == *b) << '\n'; // 0
}