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// SPDX-FileCopyrightText: Copyright (C) 2023 Tobias Hienzsch
3
4#ifndef TETL_CHRONO_WEEKDAY_LAST_HPP
5#define TETL_CHRONO_WEEKDAY_LAST_HPP
6
7#include <etl/_chrono/weekday.hpp>
8
9namespace etl::chrono {
10
11/// \ingroup chrono
13 constexpr explicit weekday_last(chrono::weekday const& wd) noexcept
14 : _wd{wd}
15 {
16 }
17
18 [[nodiscard]] constexpr auto weekday() const noexcept -> chrono::weekday
19 {
20 return _wd;
21 }
22
23 [[nodiscard]] constexpr auto ok() const noexcept -> bool
24 {
25 return _wd.ok();
26 }
27
28 friend constexpr auto operator==(weekday_last lhs, weekday_last rhs) noexcept -> bool
29 {
30 return lhs.weekday() == rhs.weekday();
31 }
32
33private:
34 chrono::weekday _wd;
35};
36
37constexpr auto weekday::operator[](etl::chrono::last_spec /*tag*/) const noexcept -> weekday_last
38{
39 return weekday_last{*this};
40}
41
42} // namespace etl::chrono
43
44#endif // TETL_CHRONO_WEEKDAY_LAST_HPP
Definition abs.hpp:12
Definition adjacent_find.hpp:9
last_spec is an empty tag type that is used in conjunction with other calendar types to indicate the ...
Definition last_spec.hpp:20
Definition weekday_last.hpp:12
constexpr auto ok() const noexcept -> bool
Definition weekday_last.hpp:23
constexpr weekday_last(chrono::weekday const &wd) noexcept
Definition weekday_last.hpp:13
constexpr auto weekday() const noexcept -> chrono::weekday
Definition weekday_last.hpp:18
friend constexpr auto operator==(weekday_last lhs, weekday_last rhs) noexcept -> bool
Definition weekday_last.hpp:28
Definition weekday.hpp:19
constexpr auto ok() const noexcept -> bool
Definition weekday.hpp:81
constexpr auto operator[](etl::chrono::last_spec) const noexcept -> weekday_last
Definition weekday_last.hpp:37
friend constexpr auto operator==(weekday const &lhs, weekday const &rhs) noexcept -> bool
Definition weekday.hpp:92