26 using version_element = std::uint32_t;
30 constexpr version(version_element major = 0, version_element minor = 0) noexcept :
37 constexpr bool empty() const noexcept
39 return major == 0 && minor == 0;
45 explicit constexpr operator std::uint64_t()
const
47 return static_cast<std::uint64_t
>(major) << 32
48 |
static_cast<std::uint64_t
>(minor) << 0;
55 return static_cast<std::uint64_t
>(*this) ==
static_cast<std::uint64_t
>(other);
62 return static_cast<std::uint64_t
>(*this) !=
static_cast<std::uint64_t
>(other);
69 return static_cast<std::uint64_t
>(*this) <
static_cast<std::uint64_t
>(other);
76 return static_cast<std::uint64_t
>(*this) <=
static_cast<std::uint64_t
>(other);
83 return static_cast<std::uint64_t
>(*this) >
static_cast<std::uint64_t
>(other);
90 return static_cast<std::uint64_t
>(*this) >=
static_cast<std::uint64_t
>(other);
94 version_element major;
95 version_element minor;
98JSONV_PUBLIC std::ostream& operator<<(std::ostream&,
const version&);
Copyright (c) 2014-2020 by Travis Gockel.
#define JSONV_NODISCARD
Warn if the caller discards the result of this function.
#define JSONV_PUBLIC
This function or class is part of the public API for JSON Voorhees.
Represents a version used to extract and encode JSON objects from C++ classes.
constexpr bool operator<=(const version &other) const
Check that this version is less than or equal to other. The comparison is done lexicographically.
constexpr bool operator==(const version &other) const
Test for equality with other.
constexpr bool operator<(const version &other) const
Check that this version is less than other. The comparison is done lexicographically.
constexpr bool operator>=(const version &other) const
Check that this version is greater than or equal to other. The comparison is done lexicographically.
constexpr bool operator>(const version &other) const
Check that this version is greater than other. The comparison is done lexicographically.
constexpr version(version_element major=0, version_element minor=0) noexcept
Initialize an instance with the given major and minor version info.
constexpr bool empty() const noexcept
Check if this version is an "empty" value – meaning major and minor are both 0.
constexpr bool operator!=(const version &other) const
Test for inequality with other.