Namespaces
Variants

std::chrono::month_day_last:: month

From cppreference.net
constexpr std:: chrono :: month month ( ) const noexcept ;
(C++20부터)

저장된 std::chrono::month 객체의 복사본을 * this 에서 가져옵니다.

반환값

std::chrono::month 객체에 저장된 복사본을 * this 에 보관합니다.

예제

#include <chrono>
#include <iostream>
using namespace std::chrono;
int main()
{
    std::cout << std::boolalpha;
    auto mdl{February/last}; // 2월의 마지막 날
    auto ymdl{year(2020) / mdl};
    std::cout << (year_month_day{ymdl} == year_month_day{February/29/2020}) << ' ';
    mdl = (mdl.month() + months(1)) / last; // 2020년 다음 달의 마지막 날
    ymdl = year(2020) / mdl;
    std::cout << (year_month_day{ymdl} == year_month_day{March/31/2020}) << '\n';
}

출력:

true true