tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
month_day_last.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CHRONO_MONTH_DAY_LAST_HPP
4#define TETL_CHRONO_MONTH_DAY_LAST_HPP
5
7
8namespace etl::chrono {
9
12 constexpr explicit month_day_last(chrono::month const& m) noexcept
13 : _m{m}
14 {
15 }
16
17 [[nodiscard]] constexpr auto month() const noexcept -> chrono::month { return _m; }
18
19 [[nodiscard]] constexpr auto ok() const noexcept -> bool { return month().ok(); }
20
21 friend constexpr auto operator==(month_day_last const& lhs, month_day_last const& rhs) noexcept -> bool
22 {
23 return lhs.month() == rhs.month();
24 }
25
26private:
28};
29
30[[nodiscard]] constexpr auto operator/(month const& m, last_spec /*tag*/) noexcept -> month_day_last
31{
32 return month_day_last{m};
33}
34
35[[nodiscard]] constexpr auto operator/(int m, last_spec /*tag*/) noexcept -> month_day_last
36{
37 return month_day_last{month(static_cast<unsigned>(m))};
38}
39
40[[nodiscard]] constexpr auto operator/(last_spec /*tag*/, month const& m) noexcept -> month_day_last
41{
42 return month_day_last{m};
43}
44
45[[nodiscard]] constexpr auto operator/(last_spec /*tag*/, int m) noexcept -> month_day_last
46{
47 return month_day_last{month(static_cast<unsigned>(m))};
48}
49
50} // namespace etl::chrono
51
52#endif // TETL_CHRONO_MONTH_DAY_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
last_spec is an empty tag type that is used in conjunction with other calendar types to indicate the ...
Definition last_spec.hpp:19
Definition month_day_last.hpp:11
constexpr auto ok() const noexcept -> bool
Definition month_day_last.hpp:19
constexpr auto month() const noexcept -> chrono::month
Definition month_day_last.hpp:17
friend constexpr auto operator==(month_day_last const &lhs, month_day_last const &rhs) noexcept -> bool
Definition month_day_last.hpp:21
constexpr month_day_last(chrono::month const &m) noexcept
Definition month_day_last.hpp:12
The class month represents a month in a year.
Definition month.hpp:21