More chrono documentation

This commit is contained in:
John Wellbelove 2026-04-13 23:39:17 +02:00
parent 09af946a8f
commit 6604e8e40c
18 changed files with 567 additions and 340 deletions

View File

@ -8,7 +8,7 @@ title: "day"
Similar to: [std::chrono::day](https://en.cppreference.com/w/cpp/chrono/day.html)
{{< /callout >}}
A template representing a day.
A class representing a day.
```cpp
class day
@ -64,9 +64,9 @@ int compare(const etl::chrono::day& other) const
ETL_NOEXCEPT
```
**Description**
Compare `day` with another.
if `day < other`, returns `-1`
else if `day > other`, returns `1`
Compare `day` with another.
if `day < other`, returns `-1`
else if `day > other`, returns `1`
else returns `0`
## Assignment

View File

@ -93,7 +93,7 @@ int compare(const time_point& other) const
ETL_NOEXCEPT
```
**Description**
Compare day with another.
Compare day with another.
if `time_point < other`, returns `-1`
else if `time_point > other`, returns `1`
else returns `0`

View File

@ -1,197 +1,319 @@
month
A template representing a month.
Back to chrono
____________________________________________________________________________________________________
month
---
title: "month"
---
STL equivalent: std::chrono::month
{{< callout type="info">}}
Header: `chrono.h`
Since: `20.41.0`
Similar to: [std::chrono::month](https://en.cppreference.com/w/cpp/chrono/month.html)
{{< /callout >}}
A class representing a month.
```cpp
class month
____________________________________________________________________________________________________
Typesdefs
rep The internal representation.
____________________________________________________________________________________________________
Construction
```
## Member types
`rep` The internal representation.
## Construction
```cpp
ETL_CONSTEXPR
month()
ETL_NOEXCEPT
```
**Description**
Default constructor.
______________________________________________
---
```cpp
ETL_CONSTEXPR
explicit month(unsigned value)
ETL_NOEXCEPT
```
**Description**
Construct from unsigned.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
month(const etl::chrono::month& other)
ETL_NOEXCEPT
```
**Description**
Copy constructor.
____________________________________________________________________________________________________
Tests
## Tests
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
bool ok() const
ETL_NOEXCEPT
```
**Description**
Returns true if the month is in range.
______________________________________________
---
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
int compare(const etl::chrono::month& other) const
ETL_NOEXCEPT
Compare month with another.
if month < other, returns -1
else if month > other, returns 1
```
**Description**
Compare month with another.
if month < other, returns -1
else if month > other, returns 1
else returns 0
____________________________________________________________________________________________________
Assignment
## Assignment
```cpp
ETL_CONSTEXPR14
etl::chrono::month& operator =(const etl::chrono::month& rhs)
ETL_NOEXCEPT
```
**Description**
Assignment operator
____________________________________________________________________________________________________
Increment/decrement
## Increment / decrement
```cpp
ETL_CONSTEXPR14
etl::chrono::month& operator ++()
ETL_NOEXCEPT
```
**Description**
Pre-increment operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
etl::chrono::month operator ++(int)
ETL_NOEXCEPT
```
**Description**
Post-increment operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
etl::chrono::month& operator --()
ETL_NOEXCEPT
```
**Description**
Pre-decrement operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
etl::chrono::month operator --(int)
ETL_NOEXCEPT
```
**Description**
Post-decrement operator.
____________________________________________________________________________________________________
Mathematical operators
## Mathematical operators
```cpp
ETL_CONSTEXPR14
etl::chrono::month& operator +=(const etl::chrono::months& ms)
ETL_NOEXCEPT
Plus-equals operator adding etl::chrono::months.
______________________________________________
```
**Description**
Plus-equals operator adding `etl::chrono::months`.
---
```cpp
ETL_CONSTEXPR14
etl::chrono::month& operator -=(const etl::chrono::months& ms)
ETL_NOEXCEPT
Minus-equals operator subtracting etl::chrono::months.
____________________________________________________________________________________________________
Constants
```
**Description**
Minus-equals operator subtracting `etl::chrono::months`.
## Constants
```cpp
ETL_NODISCARD
static
ETL_CONSTEXPR14
etl::chrono::month min()
ETL_NOEXCEPT
```
**Description**
The minimum month value for which ok() will return true.
______________________________________________
---
```cpp
ETL_NODISCARD
static
ETL_CONSTEXPR14
etl::chrono::month max()
ETL_NOEXCEPT
```
**Description**
The maximum month value for which ok() will return true.
____________________________________________________________________________________________________
Conversion
## Conversion
```cpp
ETL_CONSTEXPR14
operator unsigned() const
ETL_NOEXCEPT
Conversion operator to unsigned int.
____________________________________________________________________________________________________
Non-member mathematical operators
```
**Description**
Conversion operator to `unsigned int`.
## Non-member mathematical operators
```cpp
ETL_CONSTEXPR14
etl::chrono::month operator +(const etl::chrono::month& m,
const etl::chrono::months& ms)
ETL_NOEXCEPT
Add etl::chrono::months to etl::chrono::month.
Returns etl::chrono::month.
______________________________________________
```
**Description**
Add `etl::chrono::months` to `etl::chrono::month`.
**Return**
`etl::chrono::month.`
---
```cpp
ETL_CONSTEXPR14
etl::chrono::month operator +(const etl::chrono::months& ms,
const etl::chrono::month& m)
ETL_NOEXCEPT
Add etl::chrono::month to etl::chrono::months.
Returns etl::chrono::month.
______________________________________________
```
**Description**
Add `etl::chrono::month` to `etl::chrono::months`.
**Return**
`etl::chrono::month`.
---
```cpp
ETL_CONSTEXPR14
etl::chrono::month operator -(const etl::chrono::month& m,
const etl::chrono::months& ms)
ETL_NOEXCEPT
Subtract etl::chrono::months from etl::chrono::month.
Returns etl::chrono::month.
______________________________________________
```
**Description**
Subtract `etl::chrono::months` from `etl::chrono::month`.
**Return**
`etl::chrono::month`.
---
```cpp
ETL_CONSTEXPR14
etl::chrono::month operator -(const etl::chrono::months& ms,
const etl::chrono::month& m)
ETL_NOEXCEPT
Subtract etl::chrono::month from etl::chrono::months.
Returns etl::chrono::months.
______________________________________________
```
**Description**
Subtract `etl::chrono::month` from `etl::chrono::months`.
**Return**
`etl::chrono::months`.
---
```cpp
ETL_CONSTEXPR14
etl::chrono::months operator -(const etl::chrono::month& m1,
const etl::chrono::month& m2) ETL_NOEXCEPT
Subtract etl::chrono::month from etl::chrono::month.
Returns etl::chrono::months.
____________________________________________________________________________________________________
Non-member comparison operators
**Description**
Subtract `etl::chrono::month` from `etl::chrono::month`.
**Return**
`etl::chrono::months`.
## Non-member comparison operators
```cpp
ETL_CONSTEXPR14
bool operator ==(const etl::chrono::month& m1,
const etl::chrono::month& m2)
ETL_NOEXCEPT
```
**Description**
Equality operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator !=(const etl::chrono::month& m1,
const etl::chrono::month& m2)
ETL_NOEXCEPT
```
**Description**
Inequality operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <(const etl::chrono::month& m1,
const etl::chrono::month& m2)
ETL_NOEXCEPT
```
**Description**
Less-than operator.
______________________________________________
```cpp
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::month& m1,
const etl::chrono::month& m2)
ETL_NOEXCEPT
```
**Description**
Less-than-or-equal operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator >(const etl::chrono::month& m1,
const etl::chrono::month& m2)
ETL_NOEXCEPT
```
**Description**
Greater-than operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator >=(const etl::chrono::month& m1,
const etl::chrono::month& m2)
ETL_NOEXCEPT
```
**Description**
Greater-than-or-equal operator.
______________________________________________
---
```cpp
[[nodiscard]] inline constexpr
auto operator <=>(const etl::chrono::month& m1,
const etl::chrono::month& m2)
noexcept
Spaceship operator.
```
**Description**
Spaceship operator.
C++20
____________________________________________________________________________________________________
Defined months
## Defined months
```cpp
etl::chrono::January
etl::chrono::February
etl::chrono::March
@ -204,10 +326,11 @@ etl::chrono::September
etl::chrono::October
etl::chrono::November
etl::chrono::December
____________________________________________________________________________________________________
Hash
```
## Hash
```cpp
template <>
struct hash<etl::chrono::month>
Hash function for etl::chrono::month
```
Hash function for `etl::chrono::month`.

View File

@ -1,104 +1,171 @@
month_day
A template representing a month and day.
Back to chrono
____________________________________________________________________________________________________
month_day
---
title: "month_day"
---
STL equivalent: std::chrono::month_day
{{< callout type="info">}}
Header: `chrono.h`
Since: `20.41.0`
Similar to: [std::chrono::month_day](https://en.cppreference.com/w/cpp/chrono/month_day.html)
{{< /callout >}}
A class representing a month and day.
```cpp
class month_day
____________________________________________________________________________________________________
Construction
```
## Construction
```cpp
ETL_CONSTEXPR
month_day()
```
**Description**
Default constructor.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
month_day(const etl::chrono::month& m,
const etl::chrono::day& d)
ETL_NOEXCEPT
Construct from month and day.
____________________________________________________________________________________________________
Access
```
**Description**
Construct from `month` and `day`.
## Access
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
etl::chrono::month month() const
ETL_NOEXCEPT
Returns the month.
______________________________________________
```
**Return**
The month.
---
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
etl::chrono::day day() const
ETL_NOEXCEPT
Returns the day.
____________________________________________________________________________________________________
Tests
```
**Return**
The day.
## Tests
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
bool ok() const
ETL_NOEXCEPT
Returns true if the month and day is within the valid limits.
______________________________________________
```
**Return**
`true` if the month and day is within the valid limits.
---
```cpp
ETL_CONSTEXPR14
int compare(const month_day& other) const
ETL_NOEXCEPT
Compare month_day with another.
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
____________________________________________________________________________________________________
Non-member comparison operators
```
**Description**
Compare `month_day` with another.
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`
## Non-member comparison operators
```cpp
ETL_CONSTEXPR14
bool operator ==(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs)
ETL_NOEXCEPT
```
**Description**
Equality operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator !=(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs)
ETL_NOEXCEPT
```
**Description**
Inequality operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs)
ETL_NOEXCEPT
```
**Description**
Less-than operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs)
ETL_NOEXCEPT
```
**Description**
Less-than-equal operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs)
ETL_NOEXCEPT
```
**Description**
Greater-than operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs)
ETL_NOEXCEPT
```
**Description**
Greater-than-equal operator.
______________________________________________
---
```cpp
[[nodiscard]] constexpr
auto operator <=>(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs)
ETL_NOEXCEPT
Spaceship operator
____________________________________________________________________________________________________
Hash
```
**Description**
Spaceship operator.
C++20
## Hash
```cpp
template <typename TRep, typename TPeriod>
struct hash<etl::chrono::month_day>
Hash function for etl::chrono::month_day
```
**Description**
Hash function for `etl::chrono::month_day`.

View File

@ -1,91 +1,147 @@
month_day_last
A template representing a month and day.
Back to chrono
____________________________________________________________________________________________________
month_day_last
---
title: "month_day_last"
---
STL equivalent: std::chrono::month_day_last
{{< callout type="info">}}
Header: `chrono.h`
Since: `20.41.0`
Similar to: [std::chrono::month_day_last](https://en.cppreference.com/w/cpp/chrono/month_day_last.html)
{{< /callout >}}
A class representing a month and last day.
```cpp
class month_day_last
____________________________________________________________________________________________________
Construction
```
## Construction
```cpp
ETL_CONSTEXPR14
explicit month_day_last(const etl::chrono::month& m)
ETL_NOEXCEPT
```
**Description**
Construct from month.
____________________________________________________________________________________________________
Access
## Access
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
etl::chrono::month month() const
ETL_NOEXCEPT
Returns the month.
____________________________________________________________________________________________________
Tests
```
**Return**
The month.
## Tests
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
bool ok() const
ETL_NOEXCEPT
Returns true if the month is within the valid limits.
______________________________________________
```
**Return**
`true` if the month is within the valid limits.
---
```cpp
ETL_CONSTEXPR14
int compare(const month_day_last& other) const
ETL_NOEXCEPT
Compare month_day_last with another.
if month < other.month, returns -1
else if month > other.month, returns 1
else returns 0
____________________________________________________________________________________________________
Non-member comparison operators
```
**Description**
Compare `month_day_last` with another.
if `month < other.month`, returns `-1`
else if `month > other.month`, returns `1`
else returns `0`
## Non-member comparison operators
```cpp
ETL_CONSTEXPR14
bool operator ==(const etl::chrono::month_day_last& lhs,
const etl::chrono::month_day_last& rhs)
ETL_NOEXCEPT
```
**Description**
Equality operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator !=(const etl::chrono::month_day_last& lhs,
const etl::chrono::month_day_last& rhs)
ETL_NOEXCEPT
```
**Description**
Inequality operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <(const etl::chrono::month_day_last& lhs,
const etl::chrono::month_day_last& rhs)
ETL_NOEXCEPT
```
**Description**
Less-than operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::month_day_last& lhs,
const etl::chrono::month_day_last& rhs)
ETL_NOEXCEPT
```
**Description**
Less-than-equal operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <(const etl::chrono::month_day_last& lhs,
const etl::chrono::month_day_last& rhs)
ETL_NOEXCEPT
```
**Description**
Greater-than operator.
______________________________________________
---
```cpp
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::month_day_last& lhs,
const etl::chrono::month_day_last& rhs)
ETL_NOEXCEPT
```
**Description**
Greater-than-equal operator.
______________________________________________
---
```cpp
[[nodiscard]] constexpr
auto operator <=>(const etl::chrono::month_day_last& lhs,
const etl::chrono::month_day_last& rhs)
ETL_NOEXCEPT
Spaceship operator
____________________________________________________________________________________________________
Hash
```
**Description**
Spaceship operator.
C++20
## Hash
```cpp
template <typename TRep, typename TPeriod>
struct hash<etl::chrono::month_day_last>
Hash function for etl::chrono::month_day_last
```
**Description**
Hash function for `etl::chrono::month_day_last`.

View File

@ -0,0 +1,156 @@
---
title: "month_weekday"
---
{{< callout type="info">}}
Header: `chrono.h`
Since: `20.41.0`
Similar to: [std::chrono::month_weekday](https://en.cppreference.com/w/cpp/chrono/month_weekday.html)
{{< /callout >}}
A class representing a month and weekday.
```cpp
class month_weekday
```
## Construction
```cpp
ETL_CONSTEXPR
month_weekday()
```
**Decription**
Default constructor.
---
```cpp
ETL_CONSTEXPR14
month_weekday(const etl::chrono::month& m,
const etl::chrono::weekday_indexed& wd)
ETL_NOEXCEPT
```
**Decription**
Construct from month and weekday_indexed.
## Access
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
etl::chrono::month month() const
ETL_NOEXCEPT
```
**Returns**
The month.
---
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
etl::chrono::weekday_indexed weekday_indexed() const
ETL_NOEXCEPT
```
**Return**
The weekday.
## Tests
```cpp
ETL_NODISCARD
ETL_CONSTEXPR14
bool ok() const
ETL_NOEXCEPT
```
**Return**
`true` if the month and day is within the valid limits.
## Non-member comparison operators
```cpp
ETL_CONSTEXPR14
bool operator ==(const etl::chrono::month_weekday& lhs,
const etl::chrono::month_weekday& rhs)
ETL_NOEXCEPT
```
**Decription**
Equality operator.
---
```cpp
ETL_CONSTEXPR14
bool operator !=(const etl::chrono::month_weekday& lhs,
const etl::chrono::month_weekday& rhs)
ETL_NOEXCEPT
```
**Decription**
Inequality operator.
---
```cpp
ETL_CONSTEXPR14
bool operator <(const etl::chrono::month_weekday& lhs,
const etl::chrono::month_weekday& rhs)
ETL_NOEXCEPT
```
**Decription**
Less-than operator.
---
```cpp
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::month_weekday& lhs,
const etl::chrono::month_weekday& rhs)
ETL_NOEXCEPT
```
**Decription**
Less-than-equal operator.
---
```cpp
ETL_CONSTEXPR14
bool operator <(const etl::chrono::month_weekday& lhs,
const etl::chrono::month_weekday& rhs)
ETL_NOEXCEPT
```
**Decription**
Greater-than operator.
---
```cpp
ETL_CONSTEXPR14
bool operator <=(const etl::chrono::month_weekday& lhs,
const etl::chrono::month_weekday& rhs)
ETL_NOEXCEPT
```
**Decription**
Greater-than-equal operator.
---
```cpp
[[nodiscard]] constexpr
auto operator <=>(const etl::chrono::month_weekday& lhs,
const etl::chrono::month_weekday& rhs)
ETL_NOEXCEPT
```
**Decription**
Spaceship operator.
C++20
## Hash
```cpp
template <typename TRep, typename TPeriod>
struct hash<etl::chrono::month_weekday>
```
**Decription**
Hash function for `etl::chrono::month_weekday`.

View File

@ -175,9 +175,9 @@ ETL_CONSTEXPR14 int compare(const time_point& other) const
ETL_NOEXCEPT
```
**Description**
Compare day with another.
If time_point < other, returns -1
else if time_point > other, returns 1
Compare day with another.
If time_point < other, returns -1
else if time_point > other, returns 1
else returns 0
## Non-member comparison operators

View File

@ -8,7 +8,7 @@ title: "year"
Similar to: [std::chrono::year](https://en.cppreference.com/w/cpp/chrono/year.html)
{{< /callout >}}
A template representing a year.
A class representing a year.
```cpp
class year
@ -55,9 +55,9 @@ int compare(const etl::chrono::year& other) const
ETL_NOEXCEPT
```
**Description**
Compare day with another.
if `year < other`, returns `-1`
else if `year > other`, returns `1`
Compare day with another.
if `year < other`, returns `-1`
else if `year > other`, returns `1`
else returns `0`
## Assignment

View File

@ -8,7 +8,7 @@ title: "year_month"
Similar to: [std::chrono::year_month](https://en.cppreference.com/w/cpp/chrono/year_month.html)
{{< /callout >}}
A template representing a year and month.
A class representing a year and month.
```cpp
class year_month
@ -199,11 +199,11 @@ int compare(const year_month& other) const
ETL_NOEXCEPT
```
**Description**
Compare year_month with another.
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`
Compare year_month with another.
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

View File

@ -8,7 +8,7 @@ title: "year_month_day"
Similar to: [std::chrono::year_month_day](https://en.cppreference.com/w/cpp/chrono/year_month_day.html)
{{< /callout >}}
A template representing a year, month, and day.
A class representing a year, month, and day.
```cpp
class year_month_day
@ -116,8 +116,8 @@ int compare(const etl::chrono::year_month_day& other) const
ETL_NOEXCEPT
```
**Description**
Compare `year_month_day` with another.
if `year < other.year`, returns `-1`
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`

View File

@ -60,7 +60,7 @@ auto data = etl::make_array<int>(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
`reverse_iterator`
`const_reverse_iterator`
'etl::array' iterators are random access.
`etl::array` iterators are random access.
## Static Constants

View File

@ -1,5 +1,5 @@
month_weekday
A template representing a month and weekday.
A class representing a month and weekday.
Back to chrono
____________________________________________________________________________________________________
month_weekday

View File

@ -1,5 +1,5 @@
month_weekday_last
A template representing a month and weekday_last.
A class representing a month and weekday_last.
Back to chrono
____________________________________________________________________________________________________
month_weekday_last

View File

@ -1,5 +1,5 @@
weekday
A template representing a weekday.
A class representing a weekday.
Back to chrono
____________________________________________________________________________________________________
weekday

View File

@ -1,5 +1,5 @@
weekday_indexed
A template representing a weekday_indexed.
A class representing a weekday_indexed.
Back to chrono
____________________________________________________________________________________________________
weekday_indexed

View File

@ -1,5 +1,5 @@
weekday_last
A template representing a weekday_last.
A class representing a weekday_last.
Back to chrono
____________________________________________________________________________________________________
weekday_last

View File

@ -1,175 +0,0 @@
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

View File

@ -1,5 +1,5 @@
year_month_day_last
A template representing a year and month.
A class representing a year and month.
Back to chrono
____________________________________________________________________________________________________
year_month_day_last