https://github.com/erengy/semaver
Semantic Versioning
https://github.com/erengy/semaver
cpp17 header-only no-dependencies semantic-versioning semver single-header
Last synced: about 1 year ago
JSON representation
Semantic Versioning
- Host: GitHub
- URL: https://github.com/erengy/semaver
- Owner: erengy
- License: mit
- Created: 2016-11-05T14:37:10.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-10-09T14:28:39.000Z (over 1 year ago)
- Last Synced: 2025-04-06T12:39:44.046Z (about 1 year ago)
- Topics: cpp17, header-only, no-dependencies, semantic-versioning, semver, single-header
- Language: C++
- Homepage: https://semver.org
- Size: 43 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Semaver
A single-header C++ library for using [Semantic Versioning](https://semver.org) in your applications.
## Usage
```cpp
#include
#include
using Version = semaver::Version;
int main() {
auto v = Version(); // 0.1.0
v = Version(1, 2, 3); // 0.1.0 → 1.2.3
v.increment_major(); // 1.2.3 → 2.0.0
if (v > Version("2.0.0-beta")) { // 2.0.0 > 2.0.0-beta
std::cout << v.to_string() << " > 2.0.0-beta\n";
}
if (auto v = Version("x.y.z"); !v) {
std::cout << "Invalid version\n";
}
return 0;
}
```
## License
Licensed under the [MIT License](https://opensource.org/licenses/MIT).