std::chrono...last::month,(3)
β¨ NAME β¨
Hi bestie π welcome to std::chrono...last::month,(3) from the C++ Standard Libary β yes, thatβs the manual name, typo and all, we keep it iconic.
The NAME line is exactly this chaotic cutie:
std::chrono::year_month_weekday_last::year,std::chrono::year_month_weekday_last::month, β std::chrono::year_month_weekday_last::year,std::chrono::year_month_weekday_last::month,
And the page itself covers accessors for year, month, weekday, and weekday_last, which youβll see in the synopsis below. periodt β¨
πΈ Synopsis πΈ
First, the synopsis has this line chilling above everything:
std::chrono::year_month_weekday_last::weekday_last
Then the four signatures, all constexpr and noexcept, all since C++20:
constexpr std::chrono::year year() const noexcept;
(1) (since C++20)
constexpr std::chrono::month month() const noexcept;
(2) (since C++20)
constexpr std::chrono::weekday weekday() const noexcept;
(3) (since C++20)
constexpr std::chrono::weekday_last weekday_last() const noexcept;
(4) (since C++20)
The whole vibe here: it retrieves the field values stored in this year_month_weekday_last object. Thatβs literally the job. π«Ά
π Return value π
- Returns the stored
std::chrono::yearvalue. π - Returns the stored
std::chrono::monthvalue. πΈ - Returns the stored
std::chrono::weekdayvalue. π¦ std::chrono::weekday_last(weekday())π
π¦ Example π¦
Run this code, bestie β the original literally says // Run this code, so go off:
#include <chrono>
#include <iostream>
using namespace std::chrono;
int main()
{
auto ymwdl{Tuesday[last]/November/2022};
auto wdl = ymwdl.weekday_last();
wdl = (wdl.weekday() + days(1))[last];
ymwdl = {ymwdl.year() + years(1), ymwdl.month() - months(2), wdl};
std::cout << year_month_day(ymwdl) << '\n';
}
β Output β
2023-09-27
Thatβs the page, bestie π source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::chrono...last::month,(3). Bye and slay your chrono builds π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms