tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
weekday_last.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CHRONO_WEEKDAY_LAST_HPP
4#define TETL_CHRONO_WEEKDAY_LAST_HPP
5
7
8namespace etl::chrono {
9
12 constexpr explicit weekday_last(chrono::weekday const& wd) noexcept
13 : _wd{wd}
14 {
15 }
16
17 [[nodiscard]] constexpr auto weekday() const noexcept -> chrono::weekday { return _wd; }
18
19 [[nodiscard]] constexpr auto ok() const noexcept -> bool { return _wd.ok(); }
20
21 friend constexpr auto operator==(weekday_last lhs, weekday_last rhs) noexcept -> bool
22 {
23 return lhs.weekday() == rhs.weekday();
24 }
25
26private:
28};
29
30constexpr auto weekday::operator[](etl::chrono::last_spec /*tag*/) const noexcept -> weekday_last
31{
32 return weekday_last{*this};
33}
34
35} // namespace etl::chrono
36
37#endif // TETL_CHRONO_WEEKDAY_LAST_HPP
Definition abs.hpp:11
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 weekday_last.hpp:11
constexpr auto ok() const noexcept -> bool
Definition weekday_last.hpp:19
constexpr weekday_last(chrono::weekday const &wd) noexcept
Definition weekday_last.hpp:12
constexpr auto weekday() const noexcept -> chrono::weekday
Definition weekday_last.hpp:17
friend constexpr auto operator==(weekday_last lhs, weekday_last rhs) noexcept -> bool
Definition weekday_last.hpp:21
Definition weekday.hpp:18
constexpr auto operator[](unsigned index) const noexcept -> weekday_indexed
Definition weekday_indexed.hpp:39