Neargye/semver

Semantic Versioning for modern C++

C++

355

223 commits

updated Aug 21, 2026

See the code

README

GitHub releases vcpkg package Conan package License

Header-only C++17 library for Semantic Versioning 2.0.0. It provides version parsing and validation, comparison, formatting, increments, and a documented range syntax for common version constraints. No dependencies.

#include <cassert>
#include <semver.hpp>

int main() {
  const auto version = semver::from_string("1.2.3");
  assert(version.major() == 1);

  const auto range = semver::try_parse_range("^1.2");
  if (!range)
    return 1;

  assert(range->contains(version));
}

Features

  • SemVer 2.0.0 parsing and validation with configurable input limits.
  • Configurable unsigned component types; version<> uses std::uint32_t.
  • Mixed-type version comparison and range matching without narrowing.
  • Compact */x/X wildcard, partial, comparator, tilde, caret, whitespace-AND, and || range syntax.
  • Range matching, intersection checks, and minimum-version queries.
  • from_chars/to_chars, streams, std::hash, and optional std::format support.
  • Compile-time parsing where the compiler and standard library support it.

See the API reference and limitations.

Integration

Copy semver.hpp, or use a package manager:

  • vcpkg: neargye-semver

  • Conan: neargye-semver/x.y.z

  • CPM: CPMAddPackage(GITHUB_REPOSITORY Neargye/semver GIT_TAG x.y.z)

  • CMake package:

    find_package(semver CONFIG REQUIRED)
    target_link_libraries(your_target PRIVATE semver::semver)
    

More examples are available in example/.

Compiler compatibility

semver requires C++17 or newer and supports:

  • Clang/LLVM >= 6
  • Apple Clang >= 10
  • GCC >= 7
  • Visual Studio >= 2019

MIT License

c-plus-plus
cplusplus
c-plus-plus-17
cplusplus-17
cpp
cpp17
header-only
no-dependencies
semantic-versioning
semver
single-file

Contributors

Neargye

199 commits

Naratzul

9 commits

xvitaly

2 commits

liliolett

2 commits

Neargye/semver

Semantic Versioning for modern C++

C++

355

223 commits

updated Aug 21, 2026

See the code

README

GitHub releases vcpkg package Conan package License

Header-only C++17 library for Semantic Versioning 2.0.0. It provides version parsing and validation, comparison, formatting, increments, and a documented range syntax for common version constraints. No dependencies.

#include <cassert>
#include <semver.hpp>

int main() {
  const auto version = semver::from_string("1.2.3");
  assert(version.major() == 1);

  const auto range = semver::try_parse_range("^1.2");
  if (!range)
    return 1;

  assert(range->contains(version));
}

Features

  • SemVer 2.0.0 parsing and validation with configurable input limits.
  • Configurable unsigned component types; version<> uses std::uint32_t.
  • Mixed-type version comparison and range matching without narrowing.
  • Compact */x/X wildcard, partial, comparator, tilde, caret, whitespace-AND, and || range syntax.
  • Range matching, intersection checks, and minimum-version queries.
  • from_chars/to_chars, streams, std::hash, and optional std::format support.
  • Compile-time parsing where the compiler and standard library support it.

See the API reference and limitations.

Integration

Copy semver.hpp, or use a package manager:

  • vcpkg: neargye-semver

  • Conan: neargye-semver/x.y.z

  • CPM: CPMAddPackage(GITHUB_REPOSITORY Neargye/semver GIT_TAG x.y.z)

  • CMake package:

    find_package(semver CONFIG REQUIRED)
    target_link_libraries(your_target PRIVATE semver::semver)
    

More examples are available in example/.

Compiler compatibility

semver requires C++17 or newer and supports:

  • Clang/LLVM >= 6
  • Apple Clang >= 10
  • GCC >= 7
  • Visual Studio >= 2019

MIT License

c-plus-plus
cplusplus
c-plus-plus-17
cplusplus-17
cpp
cpp17
header-only
no-dependencies
semantic-versioning
semver
single-file

Contributors

Neargye

199 commits

Naratzul

9 commits

xvitaly

2 commits

liliolett

2 commits

Languages

C++

96.9%

CMake

3.1%