Skip to content

Aurora-Community/semver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semantic Versioning C++

         _____                            _   _
        / ____|                          | | (_)
       | (___   ___ _ __ ___   __ _ _ __ | |_ _  ___
        \___ \ / _ \ '_ ` _ \ / _` | '_ \| __| |/ __|
        ____) |  __/ | | | | | (_| | | | | |_| | (__
       |_____/ \___|_| |_| |_|\__,_|_| |_|\__|_|\___|
__      __           _             _                _____
\ \    / /          (_)           (_)              / ____|_     _
 \ \  / /__ _ __ ___ _  ___  _ __  _ _ __   __ _  | |   _| |_ _| |_
  \ \/ / _ \ '__/ __| |/ _ \| '_ \| | '_ \ / _` | | |  |_   _|_   _|
   \  /  __/ |  \__ \ | (_) | | | | | | | | (_| | | |____|_|   |_|
    \/ \___|_|  |___/_|\___/|_| |_|_|_| |_|\__, |  \_____|
                                            __/ |
                                           |___/

License Build Status Build status Codacy Badge

C++ library compare and manipulate versions are available as extensions to the <major>.<minor>.<patch>-<prerelease_type>.<prerelease_number> format complying with Semantic Versioning 2.0.0

Features

  • C++17
  • Header-only
  • Dependency-free
  • Constexpr comparison: <, <=, ==, !=, > >=
  • Constexpr from string
  • To String
  • Create
constexpr version v1 = version{1, 2, 3, prerelease::rc, 4};
constexpr version v2 = v1;
  • Сomparison
constexpr semver::version v1{1, 4, 3};
constexpr semver::version v2{1, 2, 4, semver::prerelease::alpha, 10};
static_assert(v1 != v2);
static_assert(v1 > v2);
static_assert(v1 >= v2);
static_assert(v2 < v1);
static_assert(v2 <= v1);
  • To string
constexpr semver::version v{1, 2, 3, prerelease::rc, 4};
auto s = v.to_string(); // "1.2.3-rc.4"
  • From string
constexpr version v1("1.2.3-rc.4");
constexpr version v2 = "1.2.3-rc.4"_version;

Integration

You should add required file semver.hpp.

Compiler compatibility

  • Clang/LLVM >= 5
  • Visual C++ >= 15.3 / Visual Studio >= 2017
  • Xcode >= 10.2
  • GCC >= 7

Licensed under the MIT License

About

Semantic Versioning for modern C++

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 87.1%
  • CMake 12.9%