Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Represents the last weekday of a month.
Syntax
class month_weekday_last; // C++20
Remarks
The year is unspecified.
month_weekday_last is a trivially copyable and standard-layout class type.
Members
| 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. |
Non-members
| Name | Description |
|---|---|
operator== |
Determine whether two month_weekday_last instances are equal. |
operator<< |
Output a month_weekday_last to the specified stream. |
Requirements
Header: <chrono> Since C++20
Namespace: std::chrono
Compiler Option: /std:c++latest
Constructor
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;
Parameters
m
The month value for the created month_weekday_last class.
wdl
The weekday_last value for the created month_weekday_last class.
Remarks: Constructor
For information about C++20 syntax to specify dates, see operator/
Example: Create a month_weekday_last
// 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]
month()
Return the month value.
constexpr month month() const noexcept;
Return value
The month value.
ok
Check if the value stored in this month_weekday_last is in the valid range.
constexpr bool ok() const noexcept;
Return value
true if the month and weekday_last value is in the valid range. Otherwise, false.
weekday_last
Get the weekday_last value.
constexpr weekday_last weekday_last() const noexcept;
Return value
The weekday_last value.
See also
<chrono>
month class
month_day class
month_day_last class
month_weekday class
operator/