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

year_month_day

A template representing a year and month.
Back to chrono
____________________________________________________________________________________________________
year_month_day

STL equivalent: std::chrono::year_month_day

class year_month_day
____________________________________________________________________________________________________
Construction

ETL_CONSTEXPR year_month_day()
Default constructor.
______________________________________________
ETL_CONSTEXPR14
year_month_day(const etl::chrono::year&  y,
               const etl::chrono::month& m,
               const etl::chrono::day&   d)
ETL_NOEXCEPT
Construct from month and day.
______________________________________________
ETL_CONSTEXPR14
year_month_day(const etl::chrono::year_month_day_last& ymdl)
ETL_NOEXCEPT
Construct from year_month_day_last.
______________________________________________
ETL_CONSTEXPR14
year_month_day(const etl::chrono::sys_days& sd)
ETL_NOEXCEPT
Construct from sys_days.
______________________________________________
ETL_CONSTEXPR14
year_month_day(const etl::chrono::local_days& ld)
ETL_NOEXCEPT
Construct from local_days.
____________________________________________________________________________________________________
Access

ETL_NODISCARD
ETL_CONSTEXPR14
etl::chrono::year year() const
ETL_NOEXCEPT
Returns the year.
______________________________________________
ETL_NODISCARD
ETL_CONSTEXPR14
etl::chrono::month month() const
ETL_NOEXCEPT
Returns the month.
______________________________________________
ETL_NODISCARD
ETL_CONSTEXPR14 etl::chrono::day day() const ETL_NOEXCEPT
Returns the day.
____________________________________________________________________________________________________
Tests

ETL_NODISCARD
ETL_CONSTEXPR14
bool ok() const
ETL_NOEXCEPT
Returns true if the year and month is within the valid limits.
______________________________________________
ETL_NODISCARD
ETL_CONSTEXPR14
int compare(const etl::chrono::year_month_day& other) const
ETL_NOEXCEPT
Compare year_month_day with another.
if year < other.year, returns -1
else if year > other.year, returns 1
if month < other.month, returns -1
else if month > other.month, returns 1
else if day < other.day, returns -1
else if day > other.day, returns 1
else returns 0
____________________________________________________________________________________________________
operators

ETL_CONSTEXPR14
etl::chrono::year_month_day& operator +=(const etl::chrono::years& dy)
ETL_NOEXCEPT
Adds etl::chrono::years.

ETL_CONSTEXPR14
etl::chrono::year_month_day& operator +=(const etl::chrono::months& dm)
ETL_NOEXCEPT
Adds etl::chrono::months.

ETL_CONSTEXPR14
etl::chrono::year_month_day& operator -=(const etl::chrono::years& dy)
ETL_NOEXCEPT
Subtracts etl::chrono::years.

ETL_CONSTEXPR14
etl::chrono::year_month_day& operator -=(const etl::chrono::months& dm)
ETL_NOEXCEPT
Subtracts etl::chrono::months.
____________________________________________________________________________________________________
Non-member operators

ETL_CONSTEXPR14
etl::chrono::year_month_day operator +(const etl::chrono::year_month_day& ym,
                                       const etl::chrono::years&          dy)
Adds etl::chrono::years.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year_month_day operator +(const etl::chrono::years&          dy,
                                       const etl::chrono::year_month_day& ym)
ETL_NOEXCEPT
Adds etl::chrono::years.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year_month_day operator +(const etl::chrono::year_month_day& ym,
                                       const etl::chrono::months&         dm)
ETL_NOEXCEPT
Adds etl::chrono::months.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year_month operator +(const etl::chrono::months&         dm,
                                   const etl::chrono::year_month_day& ym)
ETL_NOEXCEPT
Adds etl::chrono::months.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year_month operator -(const etl::chrono::year_month_day& ym,
                                   const etl::chrono::years&          dy)
ETL_NOEXCEPT
Subtracts etl::chrono::years.
______________________________________________
ETL_CONSTEXPR14
etl::chrono::year_month operator -(const etl::chrono::year_month_day& ym,
                                   const etl::chrono::months&         dm)
ETL_NOEXCEPT
Subtracts etl::chrono::months.
___________________________________________________________________________________________________
Non-member comparison operators

ETL_CONSTEXPR14
bool operator ==(const etl::chrono::year_month_day& lhs,
                 const etl::chrono::year_month_day& rhs)
ETL_NOEXCEPT
Equality operator.
______________________________________________
ETL_CONSTEXPR14
bool operator !=(const etl::chrono::year_month_day& lhs,
                 const etl::chrono::year_month_day& rhs)
ETL_NOEXCEPT
Inequality operator.
______________________________________________
[[nodiscard]] friend constexpr
auto operator <=>(const etl::chrono::year_month_day& lhs,
                  const etl::chrono::year_month_day& rhs)
ETL_NOEXCEPT
Spaceship operator
______________________________________________
ETL_CONSTEXPR14
int compare(const year_month& other) const
ETL_NOEXCEPT
Compare year_month_day with another.
if year < other.year, returns -1
else if year > other.year, returns 1
if month < other.month, returns -1
else if month > other.month, returns 1
else if day < other.day, returns -1
else if day > other.day, returns 1
else returns 0
____________________________________________________________________________________________________
Hash

template <>
struct hash<etl::chrono::year_month_day>
Hash function for etl::chrono::year_month_day


 
chrono.h