15#ifndef CARMA_COOPERATIVE_PERCEPTION__MONTH_HPP_
16#define CARMA_COOPERATIVE_PERCEPTION__MONTH_HPP_
48 constexpr auto jan_value{1U};
49 constexpr auto dec_value{12U};
69 Month previous{*
this};
82 constexpr auto dec_value{12U};
102 Month previous{*
this};
111 constexpr explicit operator unsigned()
const {
return static_cast<unsigned>(
month_value_); }
118 [[nodiscard]]
constexpr auto ok() const ->
bool
120 constexpr auto jan_value{1U};
121 constexpr auto dec_value{12U};
136 return x.month_value_ ==
y.month_value_;
159 return x.month_value_ <
y.month_value_;
172 return x <
y ||
x ==
y;
185 return x.month_value_ >
y.month_value_;
198 return x >
y ||
x ==
y;
212 template <
typename CharT,
typename Traits>
214 -> std::basic_ostream<CharT, Traits> &
216 static constexpr std::array abbreviations{
"Jan.",
"Feb.",
"Mar.",
"Apr.",
"May",
"Jun.",
217 "Jul.",
"Aug.",
"Sep.",
"Oct.",
"Nov.",
"Dec."};
219 return os << static_cast<unsigned>(m) <<
" is not a valid month";
222 return os << abbreviations.at(
static_cast<unsigned>(m) - 1);
constexpr auto operator--(int) -> Month
Post-decrement operator overload.
constexpr auto operator++(int) -> Month
Post-increment operator overload.
friend constexpr auto operator==(const Month &x, const Month &y) -> bool
Compare exact equality between two Month instances.
std::uint8_t month_value_
constexpr auto operator++() -> Month &
Pre-increment operator overload.
friend constexpr auto operator<=(const Month &x, const Month &y) -> bool
Check if one Month instance is less than or equal to another.
friend constexpr auto operator!=(const Month &x, const Month &y) -> bool
Compare exact inequality between two Month instances.
friend auto operator<<(std::basic_ostream< CharT, Traits > &os, const Month &m) -> std::basic_ostream< CharT, Traits > &
Output a string representation of Month instance to an output stream.
constexpr auto operator--() -> Month &
Pre-decrement operator overload.
constexpr auto ok() const -> bool
Checks if Month instance's value is within valid Gregorian calendar range.
friend constexpr auto operator<(const Month &x, const Month &y) -> bool
Check if one Month instance is less than another.
friend constexpr auto operator>=(const Month &x, const Month &y) -> bool
Check if one Month instance is greater than or equal to another.
friend constexpr auto operator>(const Month &x, const Month &y) -> bool
Check if one Month instance is greater than another.
constexpr Month(std::uint8_t month_value)
Create a Month instance with the specified value.
constexpr Month September