tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
month_weekday_last.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CHRONO_MONTH_WEEKDAY_LAST_HPP
4#define TETL_CHRONO_MONTH_WEEKDAY_LAST_HPP
5
8
9namespace etl::chrono {
10
13 constexpr month_weekday_last(chrono::month const& m, chrono::weekday_last const& wdl) noexcept
14 : _m{m}
15 , _wdl{wdl}
16 {
17 }
18
19 [[nodiscard]] constexpr auto ok() const noexcept -> bool { return month().ok() and weekday_last().ok(); }
20
21 [[nodiscard]] constexpr auto month() const noexcept -> chrono::month { return _m; }
22 [[nodiscard]] constexpr auto weekday_last() const noexcept -> chrono::weekday_last { return _wdl; }
23
24 friend constexpr auto operator==(month_weekday_last const& lhs, month_weekday_last const& rhs) noexcept -> bool
25 {
26 return lhs.month() == rhs.month() and lhs.weekday_last() == rhs.weekday_last();
27 }
28
29private:
32};
33
34[[nodiscard]] constexpr auto operator/(month const& m, weekday_last const& wdl) noexcept -> month_weekday_last
35{
36 return {m, wdl};
37}
38
39[[nodiscard]] constexpr auto operator/(int m, weekday_last const& wdl) noexcept -> month_weekday_last
40{
41 return {month(static_cast<unsigned>(m)), wdl};
42}
43
44[[nodiscard]] constexpr auto operator/(weekday_last const& wdl, month const& m) noexcept -> month_weekday_last
45{
46 return {m, wdl};
47}
48
49[[nodiscard]] constexpr auto operator/(weekday_last const& wdl, int m) noexcept -> month_weekday_last
50{
51 return {month(static_cast<unsigned>(m)), wdl};
52}
53
54} // namespace etl::chrono
55
56#endif // TETL_CHRONO_MONTH_WEEKDAY_LAST_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_last.hpp:12
constexpr auto ok() const noexcept -> bool
Definition month_weekday_last.hpp:19
friend constexpr auto operator==(month_weekday_last const &lhs, month_weekday_last const &rhs) noexcept -> bool
Definition month_weekday_last.hpp:24
constexpr auto month() const noexcept -> chrono::month
Definition month_weekday_last.hpp:21
constexpr month_weekday_last(chrono::month const &m, chrono::weekday_last const &wdl) noexcept
Definition month_weekday_last.hpp:13
constexpr auto weekday_last() const noexcept -> chrono::weekday_last
Definition month_weekday_last.hpp:22
The class month represents a month in a year.
Definition month.hpp:21
Definition weekday_last.hpp:11