title | description | ms.date | f1_keywords | helpviewer_keywords | dev_langs | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
month_weekday_last class |
Learn more about: month_weekday_last Class |
6/28/2021 |
|
|
|
Represents the last weekday of a month.
class month_weekday_last; // C++20
The year is unspecified.
month_weekday_last
is a trivially copyable and standard-layout class type.
Name | Description |
---|---|
Constructors | Constructs a month_weekday_last |
month |
Get the month value. |
ok |
Check if the month_weekday_last is valid. |
weekday_last |
Get the weekday value. |
Name | Description |
---|---|
operator== |
Determine whether two month_weekday_last instances are equal. |
operator<< |
Output a month_weekday_last to the specified stream. |
Header: <chrono>
Since C++20
Namespace: std::chrono
Compiler Option: /std:c++latest
Construct a month_weekday_last
initialized with a month
and weekday_last
value.
constexpr month_weekday_last(const month& m, const weekday_last& wdl) noexcept;
m
The month
value for the created month_weekday_last
class.
wdl
The weekday_last
value for the created month_weekday_last
class.
For information about C++20 syntax to specify dates, see operator/
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main()
{
constexpr auto mwdl{ January / Monday[last] }; // wdl is the last Monday of January of an unspecified year
std::cout << mwdl << "\n";
const auto theMonth = August;
const auto wdl = Friday[last];
month_weekday_last mwdl2(theMonth, wdl);
std::cout << mwdl2;
return 0;
}
Jan/Mon[last]
Aug/Fri[last]
Return the month value.
constexpr month month() const noexcept;
The month value.
Check if the value stored in this month_weekday_last
is in the valid range.
constexpr bool ok() const noexcept;
true
if the month
and weekday_last
value is in the valid range. Otherwise, false
.
Get the weekday_last
value.
constexpr weekday_last weekday_last() const noexcept;
The weekday_last
value.
<chrono>
month
class
month_day
class
month_day_last
class
month_weekday
class
operator/