|
commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
|
A semantic version: major.minor.patch with optional prerelease/build.
More...
#include <semver.hpp>
Public Member Functions | |
| std::string | to_string () const |
The canonical string: major.minor.patch, then -prerelease if set, then +build if set. | |
| std::strong_ordering | operator<=> (const SemVer &o) const |
Total order over major, minor, patch, then prerelease per §11. | |
| bool | operator== (const SemVer &o) const |
Equality consistent with <=> (so it likewise ignores build metadata). | |
Static Public Member Functions | |
| static std::optional< SemVer > | parse (std::string_view s) |
| Non-throwing parse. | |
Public Attributes | |
| std::string | prerelease |
| Part after '-', before '+' (no leading '-'). | |
| std::string | build |
| Part after '+' (no leading '+'). | |
A semantic version: major.minor.patch with optional prerelease/build.
|
inline |
Total order over major, minor, patch, then prerelease per §11.
Build metadata is excluded (§10).
|
inline |
Equality consistent with <=> (so it likewise ignores build metadata).
Cannot be defaulted: the custom <=> excludes build.
|
inlinestatic |
Non-throwing parse.
Accepts an optional leading v/V, a leniently partial numeric core ("1", "1.2", "1.2.3"), and validated -prerelease / +build suffixes. Returns std::nullopt on any malformed input.