semver 1.0.0
Semantic Versioning library.
Highlights
- SemVer parsing and validation, cleaning and coercion, comparison, serialization, hashing, streams, and optional C++20 formatting.
- Configurable unsigned component types with checked construction and mixed-type comparison.
- Documented version ranges, increments, intersection checks, and minimum-version queries.
- Dependency-free single header with the installable
semver::semverCMake target.
Migration from v0.3.1
versionchanged from a fixedstd::uint16_tstructure with public fields and a predefined prerelease enum toversion<I1, I2, I3>with accessors, arbitrary SemVer prerelease identifiers, and build metadata.- Replace member parsing and the
_versionliteral with the freeparse,try_parse,try_parse_range,from_string,from_chars, andto_charsAPIs and the_semverliteral where supported. - Replace
comparators_option,satisfies_option, andsemver::range::satisfies()with normal comparison operators orcompare(), parsedrange_set::contains(), text-basedsatisfies(), andprerelease_policy.
Migration from v1.0.0-rc
- Component types must be unsigned; the defaults changed from
inttostd::uint32_t. Construction is checked, and versions with different component types compare and match ranges without narrowing. - Parsing now includes
try_parse,try_parse_range,from_string,from_chars,to_chars,clean, andcoerce. Parse result types convert toboolexplicitly, and qualifier accessors return non-owningstd::string_viewvalues. version_compare_optionwas replaced byprerelease_policy::{exclude, include}for range matching only. Normal comparison follows SemVer prerelease precedence and ignores build metadata;compare_with_build()adds an explicit deterministic metadata tie-break.- Range syntax now supports
*/x/X, partial versions,!=,~,^, whitespace intersections, and||. Hyphen ranges are not supported. - Added
diff()andinc()with the sharedversion_changeenum,min_satisfying(),max_satisfying(),min_version(),intersects(), hashing, streams, and optional C++20 formatting. - CMake package metadata now reports
1.0.0, requests C++17, uses same-major compatibility, and is architecture-independent.
Requires C++17. CMake integration requires CMake 3.15+.