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_
16#include "arene/base/stdlib_choice/cstdint.hpp"
64 major_(major_version),
65 minor_(minor_version),
66 patch_(patch_version) {}
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();
constexpr generic_ordering_from_three_way_compare() noexcept=default
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 accumulate.hpp:37
constexpr auto to_underlying(T value) noexcept -> std::underlying_type_t< T >
This replicates a function that went into C++23 called std::to_underlying (https://wg21....
Definition to_underlying.hpp:26
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(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
strong_ordering_detail::strong_ordering strong_ordering
The enumeration specifying the result of an ordering comparison.
Definition strong_ordering.hpp:147
three_way_compare_detail::compare_three_way compare_three_way
Function object that does a three-way comparison between operands, equivalent to std::compare_three_w...
Definition compare_three_way.hpp:214
::std::uint32_t uint32_t
A 32-bit unsigned integer type.
Definition integer_types.hpp:36
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
::std::uint16_t uint16_t
A 16-bit unsigned integer type.
Definition integer_types.hpp:27
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 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
Definition accumulate.hpp:36
::uint8_t uint8_t
An 8-bit unsigned integer type.
Definition cstdint.hpp:30
::uint16_t uint16_t
A 16-bit unsigned integer type.
Definition cstdint.hpp:36
::uint32_t uint32_t
A 32-bit unsigned integer type.
Definition cstdint.hpp:41
#define ARENE_NODISCARD
An alias for [[nodiscard]] , or a no-op if the attribute is not supported.
Definition nodiscard.hpp:26