A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove

year

A template representing a year.
Back to chrono
____________________________________________________________________________________________________
year

STL equivalent: std::chrono::year

class year
____________________________________________________________________________________________________
Typesdefs
rep  The internal representation.
____________________________________________________________________________________________________
Construction

ETL_CONSTEXPR
year()
ETL_NOEXCEPT
Default constructor.
______________________________________________
ETL_CONSTEXPR
explicit year(unsigned value)
ETL_NOEXCEPT
Construct from unsigned.
______________________________________________
ETL_CONSTEXPR14
year(const etl::chrono::year& other)
ETL_NOEXCEPT
Copy constructor.
____________________________________________________________________________________________________
Tests

ETL_NODISCARD
ETL_CONSTEXPR14
int compare(const etl::chrono::year& other) const
ETL_NOEXCEPT
Compare day with another.
if year < other, returns -1
else if year > other, returns 1
else returns 0
____________________________________________________________________________________________________
Assignment

ETL_CONSTEXPR14
etl::chrono::year& operator =(const etl::chrono::year& rhs)
ETL_NOEXCEPT
Assignment operator     
____________________________________________________________________________________________________
Increment/decrement

ETL_CONSTEXPR14
etl::chrono::year& operator ++()
ETL_NOEXCEPT
Pre-increment operator.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year operator ++(int)
ETL_NOEXCEPT
Post-increment operator.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year& operator --()
ETL_NOEXCEPT
Pre-decrement operator.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year operator --(int)
ETL_NOEXCEPT
Post-decrement operator.
____________________________________________________________________________________________________
Mathematical operators

ETL_CONSTEXPR14
etl::chrono::year& operator +=(const etl::chrono::years& ys)
ETL_NOEXCEPT
Plus-equals operator adding etl::chrono::years.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year& operator -=(const etl::chrono::years& ys)
ETL_NOEXCEPT
Minus-equals operator subtracting etl::chrono::years.
____________________________________________________________________________________________________
Tests

ETL_NODISCARD
ETL_CONSTEXPR14
bool ok() const
ETL_NOEXCEPT
Returns true if the year is within the valid -32767 to 32767 range.
______________________________________________
ETL_NODISCARD
ETL_CONSTEXPR14
bool is_leap() const
ETL_NOEXCEPT
Returns true if the year is a leap year.
____________________________________________________________________________________________________
Constants

ETL_NODISCARD
static
ETL_CONSTEXPR14
etl::chrono::year min()
ETL_NOEXCEPT
The minimum year value for which ok() will return true.
______________________________________________
ETL_NODISCARD
static
ETL_CONSTEXPR14
etl::chrono::year max()
ETL_NOEXCEPT
The maximum year value for which ok() will return true.
____________________________________________________________________________________________________
Conversion

ETL_CONSTEXPR14
operator int() const
ETL_NOEXCEPT
Conversion operator to unsigned int.
____________________________________________________________________________________________________
Non-member mathematical operators

ETL_CONSTEXPR14
etl::chrono::year operator +(const etl::chrono::year& y,
                             const etl::chrono::years& ys)
ETL_NOEXCEPT
Add etl::chrono::years to etl::chrono::year.
Returns etl::chrono::year.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year operator +(const etl::chrono::years& ys,
                             const etl::chrono::year& y)
ETL_NOEXCEPT
Add etl::chrono::year to etl::chrono::years.
Returns etl::chrono::year.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year operator -(const etl::chrono::year& y,
                             const etl::chrono::years& ys)
ETL_NOEXCEPT
Subtract etl::chrono::years from etl::chrono::year.
Returns etl::chrono::year.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year operator -(const etl::chrono::years& ys,
                             const etl::chrono::year& y)
ETL_NOEXCEPT
Subtract etl::chrono::year from etl::chrono::years.
Returns etl::chrono::years.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::years operator -(const etl::chrono::year& y1,
                              const etl::chrono::year& y2) ETL_NOEXCEPT
Subtract etl::chrono::year from etl::chrono::year.
Returns etl::chrono::years.
____________________________________________________________________________________________________
Non-member comparison operators

ETL_CONSTEXPR14
bool operator ==(const etl::chrono::year& y1,
                 const etl::chrono::year& y2)
ETL_NOEXCEPT
Equality operator.
______________________________________________
ETL_CONSTEXPR14
bool operator !=(const etl::chrono::year& y1,
                 const etl::chrono::year& y2)
ETL_NOEXCEPT
Inequality operator.
______________________________________________
ETL_CONSTEXPR14
bool operator <(const etl::chrono::year& y1,
                const etl::chrono::year& y2)
ETL_NOEXCEPT
Less-than operator.
______________________________________________
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::year& y1,
                 const etl::chrono::year& y2)
ETL_NOEXCEPT
Less-than-or-equal operator.
______________________________________________
ETL_CONSTEXPR14
bool operator >(const etl::chrono::year& y1,
                const etl::chrono::year& y2)
ETL_NOEXCEPT
Greater-than operator.
______________________________________________
ETL_CONSTEXPR14
bool operator >=(const etl::chrono::year& y1,
                 const etl::chrono::year& y2)
ETL_NOEXCEPT
Greater-than-or-equal operator.
______________________________________________
[[nodiscard]] inline constexpr
auto operator <=>(const etl::chrono::year& y1,
                  const etl::chrono::year& y2)
noexcept
Spaceship operator.
C++20
____________________________________________________________________________________________________
Hash

template <typename TRep, typename TPeriod>
struct hash<etl::chrono::year>
Hash function for etl::chrono::year
chrono.h