std::chrono::weekday(3)
π
std::chrono::weekday(3) β C++ Standard Libary, section 3 ποΈ
Okay bestie, this is the whole manual page for std::chrono::weekday, straight from the C++ Standard Libary. Itβs giving βcalendar girl but make it constexpr,β and weβre gonna get through every single detail together. π«Ά
πΈ NAME πΈ
std::chrono::weekday β literally std::chrono::weekday, no cap. Itβs the weekday type, and yes the page says the name twice. Iconic. β¨
β¨ Synopsis β¨
Defined in header <chrono>
class weekday; (since C++20)
inline constexpr std::chrono::weekday Sunday{0}; (since C++20)
inline constexpr std::chrono::weekday Monday{1}; (since C++20)
inline constexpr std::chrono::weekday Tuesday{2}; (since C++20)
inline constexpr std::chrono::weekday Wednesday{3}; (since C++20)
inline constexpr std::chrono::weekday Thursday{4}; (since C++20)
inline constexpr std::chrono::weekday Friday{5}; (since C++20)
inline constexpr std::chrono::weekday Saturday{6}; (since C++20)
The class weekday represents a day of the week in the proleptic Gregorian calendar.
Its normal range is [0, 6], for Sunday through Saturday, but it can hold any value in the range [0, 255]. Seven named constants are predefined in the std::chrono namespace for the seven days of the week.
weekday is a TriviallyCopyable StandardLayoutType. Thatβs exactly what the page says, bestie β donβt come for me. π
π Member functions π
These are the member functions, and the page marks them as public member functions. Slay. π
- constructor β constructs a
weekday(public member function). operator++,operator++(int),operator--,operator--(int)β increments or decrements theweekday(public member function).operator+=,operator-=β adds or subtracts a number of days (public member function).c_encodingβ retrieves the stored weekday value (public member function).iso_encodingβ retrieves ISO 8601 weekday value (public member function).okβ checks if the stored weekday value is valid (public member function).operator[]β convenience syntax for constructing aweekday_indexedorweekday_lastfrom thisweekday(public member function).
π Nonmember functions π
operator==β compares twoweekdayvalues (C++20) (function).operator+,operator-β performs arithmetic on weekdays (C++20) (function).operator<<β outputs aweekdayinto a stream (C++20) (function template).from_streamβ parses aweekdayfrom a stream according to the provided format (C++20) (function template).
π Helper classes π
std::formatter<std::chrono::weekday>β formatting support forweekday(C++20) (class template specialization).std::hash<std::chrono::weekday>β hash support forstd::chrono::weekday(C++26) (class template specialization).
π§ Example π§
// Run this code
#include <chrono>
#include <iostream>
int main()
{
std::chrono::weekday x{42 / 13};
std::cout << x++ << '\n';
std::cout << x << '\n';
std::cout << ++x << '\n';
}
πΈ Output: πΈ
Wed
Thu
Fri
π¦ See also π¦
weekday_indexedβ represents then^thweekday of a month (C++20) (class).
π«Ά Thatβs the whole page, bestie. Source:http://cppreference.comΒ· version/date:2024.06.10Β· page:std::chrono::weekday(3). Slay and bye. π
π¦ 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