tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
month_weekday.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CHRONO_MONTH_WEEKDAY_HPP
4#define TETL_CHRONO_MONTH_WEEKDAY_HPP
5
8
9namespace etl::chrono {
10
13 constexpr month_weekday(chrono::month const& m, chrono::weekday_indexed const& wdi) noexcept
14 : _m{m}
15 , _wdi{wdi}
16 {
17 }
18
19 [[nodiscard]] constexpr auto month() const noexcept -> chrono::month { return _m; }
20
21 [[nodiscard]] constexpr auto weekday_indexed() const noexcept -> chrono::weekday_indexed { return _wdi; }
22
23 [[nodiscard]] constexpr auto ok() const noexcept -> bool { return month().ok() and weekday_indexed().ok(); }
24
25 friend constexpr auto operator==(month_weekday const& lhs, month_weekday const& rhs) noexcept -> bool
26 {
27 return lhs.month() == rhs.month() and lhs.weekday_indexed() == rhs.weekday_indexed();
28 }
29
30private:
33};
34
35[[nodiscard]] constexpr auto operator/(month const& m, weekday_indexed const& wdi) noexcept -> month_weekday
36{
37 return {m, wdi};
38}
39
40[[nodiscard]] constexpr auto operator/(int m, weekday_indexed const& wdi) noexcept -> month_weekday
41{
42 return {month(static_cast<unsigned>(m)), wdi};
43}
44
45[[nodiscard]] constexpr auto operator/(weekday_indexed const& wdi, month const& m) noexcept -> month_weekday
46{
47 return {m, wdi};
48}
49
50[[nodiscard]] constexpr auto operator/(weekday_indexed const& wdi, int m) noexcept -> month_weekday
51{
52 return {month(static_cast<unsigned>(m)), wdi};
53}
54
55} // namespace etl::chrono
56
57#endif // TETL_CHRONO_MONTH_WEEKDAY_HPP
Definition abs.hpp:11
constexpr auto operator/(duration< Rep1, Period1 > const &lhs, duration< Rep2, Period2 > const &rhs) -> common_type_t< Rep1, Rep2 >
Performs basic arithmetic operations between two durations or between a duration and a tick count.
Definition duration.hpp:272
Definition month_weekday.hpp:12
constexpr auto ok() const noexcept -> bool
Definition month_weekday.hpp:23
constexpr month_weekday(chrono::month const &m, chrono::weekday_indexed const &wdi) noexcept
Definition month_weekday.hpp:13
constexpr auto weekday_indexed() const noexcept -> chrono::weekday_indexed
Definition month_weekday.hpp:21
constexpr auto month() const noexcept -> chrono::month
Definition month_weekday.hpp:19
friend constexpr auto operator==(month_weekday const &lhs, month_weekday const &rhs) noexcept -> bool
Definition month_weekday.hpp:25
The class month represents a month in a year.
Definition month.hpp:21
Definition weekday_indexed.hpp:11