SysTutorials

Linux Manual Pages › Section 3

stdchronoyear(3)

std::chrono::year – std::chrono::year

Synopsis

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].
year is a TriviallyCopyable StandardLayoutType.

Member functions

                constructs a year
constructor (public member function)

operator++ increments or decrements the year
operator++(int) (public member function)
operator–
operator–(int)
                adds or subtracts a number of years from a year
operator+= (public member function)
operator-=
                applies unary operators to year
operator+ (public member function)
operator-
                determines if the year is a leap year
is_leap (public member function)
                retrieve the year value
operator_int (public member function)
                checks if the stored year value is valid
ok (public member function)

min returns the smallest possible year value
                (public static member function)
[static]

max returns the largest possible year
                (public static member function)
[static]

Nonmember functions

operator==
operator!= compares two year objects
operator< (function)
operator<=
operator>
operator>=
            performs arithmetic on years
operator+ (public member function)
operator-
            outputs a year into a stream
operator<< (function template)
            outputs a year into a stream according to the provided format
to_stream (function template)
            parses a year from a stream according to the provided format
from_stream (function template)

Literals

Defined in inline namespace std::literals::chrono_literals

operator""y A std::chrono::year literal representing a particular year
            (function)
(C++20)