Muokkaa

Jaa


month_day_last class

Represents the last day of a month.

Syntax

class month_day_last; // C++20

Members

Name Description
Constructor Construct a month_day_last
month Return the month value.
ok Check if this month_day is valid.

Non-members

Name Description
operator== Determine whether two month_days are equal.
operator<=> Compare this month_day against another month_day. The >, >=, <=, <, != operators are synthesized by the compiler.
operator<< Output a month_day to the given stream.

Requirements

Header: <chrono> (since C++20)

Namespace: std::chrono

Compiler Option: /std:c++latest

Constructor

Construct a month_day_last instance.

constexpr explicit month_day_last(const month& m) noexcept;

Parameters

m
Construct a month_day_last for the month specified by m.

Remarks

For information about C++20 syntax used to specify dates, see operator/

Example: Create a month_day_last

// compile using: /std:c++latest
#include <chrono>

using namespace std::chrono;

int main()
{
    month_day_last mdl{ October / last };
    std::cout << mdl;

    return 0;
}
Oct/last

month

Return the month value.

constexpr month month() const noexcept;

Return value

The month value.

ok

Check if the month stored in this month_day_last is valid.

constexpr bool ok() const noexcept;

Return value

true if the month value in this month_day_last is valid. Otherwise, false.

See also

<chrono>
month class
month_day class
month_day_last class
month_weekday class
month_weekday_last class
operator/ Header Files Reference