5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_SEMANTIC_VERSION_SEMANTIC_VERSION_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_SEMANTIC_VERSION_SEMANTIC_VERSION_HPP_
12#include "arene/base/compare/compare_three_way.hpp"
13#include "arene/base/compare/operators.hpp"
14#include "arene/base/compare/strong_ordering.hpp"
15#include "arene/base/compiler_support/attributes.hpp"
16#include "arene/base/stdlib_choice/cstdint.hpp"
17#include "arene/base/utility/to_underlying.hpp"
59 std::uint16_t
const major_version,
60 std::uint16_t
const minor_version = 0U,
61 std::uint32_t
const patch_version = 0U
104 std::uint16_t major_;
106 std::uint16_t minor_;
108 std::uint32_t patch_;
120 -> arene::base::strong_ordering {
121 constexpr auto cmp = compare_three_way{};
122 auto order = cmp(left.major_, right.major_);
123 if (order == arene::base::strong_ordering::equal) {
124 order = cmp(left.minor_, right.minor_);
126 if (order == arene::base::strong_ordering::equal) {
127 order = cmp(left.patch_, right.patch_);
142 return left.major() != right.major();
155 return left.minor() != right.minor();
168 return left.patch() != right.patch();
261 return contains_major_change(diff);
274 return is_major_change(compute_difference(left, right));
285 return (!is_major_change(diff)) && contains_minor_change(diff);
298 return is_minor_change(compute_difference(left, right));
322 return is_patch_change(compute_difference(left, right));
A class representing semantic versions (https://semver.org/). Does not include build metadata or prer...
Definition semantic_version.hpp:37
constexpr semantic_version() noexcept
Default ctor, creates a semver of all 0's.
Definition semantic_version.hpp:45
constexpr semantic_version(std::uint16_t const major_version, std::uint16_t const minor_version=0U, std::uint32_t const patch_version=0U) noexcept
Constructs a semantic_version with the given major, minor, and patch version.
Definition semantic_version.hpp:58
ARENE_NODISCARD constexpr auto minor() const noexcept -> std::uint16_t
Get the minor version component.
Definition semantic_version.hpp:82
ARENE_NODISCARD constexpr auto major() const noexcept -> std::uint16_t
Get the major version component.
Definition semantic_version.hpp:77
ARENE_NODISCARD constexpr auto patch() const noexcept -> std::uint32_t
Get the patch version component.
Definition semantic_version.hpp:87
static ARENE_NODISCARD constexpr auto three_way_compare(semantic_version const left, semantic_version const right) noexcept -> arene::base::strong_ordering
Implements a strong lexicographic sort order based on [major, minor, path], in that order.
Definition semantic_version.hpp:119
ARENE_NODISCARD constexpr auto is_unstable() const noexcept -> bool
Tests whether this semantic version represents an "unstable" entity, which is one with a major of 0.
Definition semantic_version.hpp:72
Definition array_exceptions_disabled.cpp:11
ARENE_NODISCARD constexpr auto is_major_change(semantic_version const left, semantic_version const right) noexcept -> bool
Binary predicate to test if two semantic_versions differ by major versions.
Definition semantic_version.hpp:273
ARENE_NODISCARD constexpr auto is_minor_change(sem_ver_diff const diff) noexcept -> bool
Predicate to test if a sem_ver_diff represents a change of minor versions, ignoring patch versions.
Definition semantic_version.hpp:284
ARENE_NODISCARD constexpr auto contains_major_change(sem_ver_diff const diff) noexcept -> bool
Predicate to test if a sem_ver_diff contains a major change.
Definition semantic_version.hpp:227
ARENE_NODISCARD constexpr auto contains_major_change(semantic_version const left, semantic_version const right) noexcept -> bool
Compares ONLY the major part of two semantic versions, to see if there's a major change between the t...
Definition semantic_version.hpp:140
ARENE_NODISCARD constexpr auto contains_minor_change(sem_ver_diff const diff) noexcept -> bool
Predicate to test if a sem_ver_diff contains a minor change.
Definition semantic_version.hpp:238
ARENE_NODISCARD constexpr auto is_patch_change(semantic_version const left, semantic_version const right) noexcept -> bool
Binary predicate to test if two semantic_versions differ by exclusively patch versions.
Definition semantic_version.hpp:321
ARENE_NODISCARD constexpr auto is_patch_change(sem_ver_diff const diff) noexcept -> bool
Predicate to test if a sem_ver_diff represents a change of exclusively patch versions.
Definition semantic_version.hpp:308
ARENE_NODISCARD constexpr auto is_major_change(sem_ver_diff const diff) noexcept -> bool
Predicate to test if a sem_ver_diff represents a change of at least one major version.
Definition semantic_version.hpp:260
ARENE_NODISCARD constexpr auto compute_difference(semantic_version const left, semantic_version const right) noexcept -> sem_ver_diff
Computes the set of the potential changes between two different semantic versions.
Definition semantic_version.hpp:202
ARENE_NODISCARD constexpr auto is_minor_change(semantic_version const left, semantic_version const right) noexcept -> bool
Binary predicate to test if two semantic_versions differ by minor versions, ignoring patch versions.
Definition semantic_version.hpp:297
ARENE_NODISCARD constexpr auto contains_patch_change(sem_ver_diff const diff) noexcept -> bool
Predicate to test if a sem_ver_diff contains a patch change.
Definition semantic_version.hpp:249
ARENE_NODISCARD constexpr auto contains_minor_change(semantic_version const left, semantic_version const right) noexcept -> bool
Compares ONLY the minor part of two semantic versions, to see if there's a minor change between the t...
Definition semantic_version.hpp:153
ARENE_NODISCARD constexpr auto contains_patch_change(semantic_version const left, semantic_version const right) noexcept -> bool
Compares ONLY the patch part of two semantic versions, to see if there's a patch change between the t...
Definition semantic_version.hpp:166
sem_ver_diff
The set of differences between two semantic_version s, encoded as a bitfield of [patch....
Definition semantic_version.hpp:173
@ major_minor_patch
A change to major, minor, and patch versions.
Definition semantic_version.hpp:190
@ none
No changes. 0b000.
Definition semantic_version.hpp:175
@ major_patch
A change to both the major and patch versions.
Definition semantic_version.hpp:186
@ minor_patch
A change to both the minor and patch versions.
Definition semantic_version.hpp:188
@ minor
A minor change. 0b010.
Definition semantic_version.hpp:179
@ major_minor
A change to both the major and minor versions.
Definition semantic_version.hpp:184
@ patch
A patch change. 0b100.
Definition semantic_version.hpp:181
@ major
A major change. 0b001.
Definition semantic_version.hpp:177
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10