32 std::optional<int> patch;
34 [[nodiscard]]
constexpr bool operator== (
const Version &other)
const
36 return major == other.major && minor == other.minor
37 && patch.value_or (0) == other.patch.value_or (0);
40 [[nodiscard]]
constexpr bool operator!= (
const Version &other)
const
42 return !(*
this == other);
45 [[nodiscard]]
constexpr bool operator< (
const Version &other)
const
47 if (major != other.major)
48 return major < other.major;
49 if (minor != other.minor)
50 return minor < other.minor;
51 auto this_patch = patch.value_or (0);
52 auto other_patch = other.patch.value_or (0);
53 return this_patch < other_patch;
56 [[nodiscard]]
constexpr bool operator> (
const Version &other)
const
61 [[nodiscard]]
constexpr bool operator<= (
const Version &other)
const
63 return !(other < *
this);
66 [[nodiscard]]
constexpr bool operator>= (
const Version &other)
const
68 return !(*
this < other);