Scroll to navigation

std::chrono::year(3) C++ Standard Libary std::chrono::year(3)

NAME

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


constructor constructs a year
(public member function)
operator++
operator++(int) increments or decrements the year
operator-- (public member function)
operator--(int)
operator+= adds or subtracts a number of years from a year
operator-= (public member function)
operator+ applies unary operators to year
operator- (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 returns the smallest possible year value
[static] (public static member function)
max returns the largest possible year
[static] (public static member function)

Non-member functions


operator== compares two year values
operator<=> (function)
(C++20)
operator+ performs arithmetic on years
operator- (function)
(C++20)
operator<< outputs a year into a stream
(C++20) (function template)
from_stream parses a year from a stream according to the provided format
(C++20) (function template)

Helper classes


std::formatter<std::chrono::year> formatting support for year
(C++20) (class template specialization)
std::hash<std::chrono::year> hash support for std::chrono::year
(C++26) (class template specialization)

Literals


Defined in inline namespace std::literals::chrono_literals
operator""y a std::chrono::year literal representing a particular year
(C++20) (function)

2024.06.10 http://cppreference.com