std::chrono...xed::weekday(3)
π NAME π
std::chrono::weekday_indexed::weekday - std::chrono::weekday_indexed::weekday
okay bestie, welcome to the C++ Standard Libary manual page for std::chrono...xed::weekday(3) π yes, we are literally here for the member function that hands you the weekday back out of a weekday_indexed. no cap.
β¨ Synopsis β¨
constexpr std::chrono::weekday weekday() const noexcept;
since C++20 π¦
It retrieves a copy of the std::chrono::weekday object stored in *this. that's the whole vibe. it's giving "tiny getter, main character energy" π
πΈ Return value πΈ
A copy of the std::chrono::weekday object stored in *this. periodt. π
π§ Example π§
// Run this code π
#include <chrono>
#include <iostream>
int main()
{
std::cout << std::boolalpha;
// 2nd Tuesday of a month
std::chrono::weekday_indexed wdi{std::chrono::Tuesday[2]};
std::cout << (std::chrono::year_month_day{wdi/10/2019} ==
std::chrono::year_month_day{std::chrono::October/8/2019})
<< ' ';
// 2nd Tuesday => 2nd Thursday
wdi = {wdi.weekday() + std::chrono::days(2), wdi.index()};
std::cout << (std::chrono::year_month_day{wdi/10/2019} ==
std::chrono::year_month_day{std::chrono::October/10/2019})
<< '\n';
}
Output:
true true
π₯ See also π₯
indexβ access the stored index (public member function) π
xoxo, your C++ bestie π β source: http://cppreference.com, version/date: 2024.06.10, page: std::chrono...xed::weekday(3). byeeee π
π¦ 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