43 constexpr
ignite_date(std::int32_t year, std::int32_t month, std::int32_t day_of_month)
45 , m_month(std::int8_t(month))
46 , m_day(std::int8_t(day_of_month)) {
53 [[nodiscard]]
constexpr std::int32_t
get_year() const noexcept {
return m_year; }
58 [[nodiscard]]
constexpr std::int_fast8_t
get_month() const noexcept {
return m_month; }
63 [[nodiscard]]
constexpr std::int_fast8_t
get_day_of_month() const noexcept {
return m_day; }
72 if (m_year != other.m_year) {
73 return m_year - other.m_year;
75 if (m_month != other.m_month) {
76 return m_month - other.m_month;
78 return m_day - other.m_day;
82 std::int_least32_t m_year = 0;
83 std::int_least8_t m_month = 1;
84 std::int_least8_t m_day = 1;
94constexpr bool operator==(
const ignite_date &lhs,
const ignite_date &rhs)
noexcept {
95 return lhs.compare(rhs) == 0;
106 return lhs.compare(rhs) != 0;
117 return lhs.compare(rhs) < 0;
128 return lhs.compare(rhs) <= 0;
139 return lhs.compare(rhs) > 0;
150 return lhs.compare(rhs) >= 0;
A date.
Definition ignite_date.h:29
constexpr ignite_date() noexcept=default
constexpr std::int_fast8_t get_day_of_month() const noexcept
Definition ignite_date.h:63
constexpr std::int32_t get_year() const noexcept
Definition ignite_date.h:53
constexpr std::int_fast8_t get_month() const noexcept
Definition ignite_date.h:58
constexpr int compare(const ignite_date &other) const noexcept
Definition ignite_date.h:71