std::chrono::year(3)
std::chrono::year(3) π
okay bestie, welcome to the std::chrono::year(3) page from the C++ Standard Libary manual π (yes, βLibaryβ is literally how the manual name is spelled in the header β iykyk). This is the whole cute little year-class situation, and weβre getting into every member, every operator, and every helper. no cap.
π NAME π
std::chrono::year β std::chrono::year
β¨ Synopsis β¨
okay so sheβs defined in header <chrono> and the class is literally this:
Defined in header <chrono>
class year; (since C++20)
The class year represents a year in the proleptic Gregorian calendar. Its range is [-32767, 32767]. Thatβs the whole range, bestie β no sneaky extra years hiding outside it.
year is a TriviallyCopyable StandardLayoutType. slay.
π Member functions π
constructorβ constructs ayear(public member function)operator++β increments or decrements the year (public member function)operator++(int)β increments or decrements the year (public member function)operator--β increments or decrements the year (public member function)operator--(int)β increments or decrements the year (public member function)operator+=β adds or subtracts a number of years from a year (public member function)operator-=β adds or subtracts a number of years from a year (public member function)operator+β applies unary operators to year (public member function)operator-β applies unary operators to year (public member function)is_leapβ determines if the year is a leap year (public member function)operator intβ retrieve the year value (public member function)okβ checks if the stored year value is valid (public member function)min[static]β returns the smallest possible year value (public static member function)max[static]β returns the largest possible year (public static member function)
π Non-member functions π
operator==,operator<=>(C++20)β compares twoyearvalues (function)operator+,operator-(C++20)β performs arithmetic on years (function)operator<<(C++20)β outputs ayearinto a stream (function template)from_stream(C++20)β parses ayearfrom a stream according to the provided format (function template)
π¦ Helper classes π¦
std::formatter<std::chrono::year>(C++20)β formatting support foryear(class template specialization)std::hash<std::chrono::year>(C++26)β hash support forstd::chrono::year(class template specialization)
πΈ Literals πΈ
Defined in inline namespace std::literals::chrono_literals
operator""y(C++20)β astd::chrono::yearliteral representing a particular year (function)
mwah π before you go: source/version is http://cppreference.com, the date is 2024.06.10, and this icon is the std::chrono::year(3) page. periodt. π
π¦ 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