time_point_common_type

time_point_common_type (시간점 공통 타입)

std::common_type<std::chrono::time_point> 특수화는 두 시간점의 공통 타입을 제공해요.

출처: cppreference

본문

std::common_type<std::chrono::time_point<Clock, Duration1>, std::chrono::time_point<Clock, Duration2>> 특수화는 같은 시계의 두 시간점의 공통 타입을 제공해요. 그 타입의 기간은 두 기간의 공통 타입이에요. <chrono> 헤더에 정의되어 있어요.

멤버 타입 (Member types)

  • typestd::chrono::time_point<Clock, std::common_type_t<Duration1, Duration2>>

두 시간점의 차이를 계산하거나 비교할 때 공통 타입을 사용해요.

예제 (Example)

#include <chrono>
#include <type_traits>

using namespace std::chrono;
static_assert(std::is_same_v<
    std::common_type_t<time_point<steady_clock, milliseconds>,
                       time_point<steady_clock, seconds>>,
    time_point<steady_clock, milliseconds>>);

더 알아보기 (Learn more)

cppreference