Schematika tokenizer (facet object model version)
- C++ 96.6%
- CMake 3.4%
| .github/workflows | ||
| cmake | ||
| example | ||
| include/xo/ratio | ||
| utest | ||
| .gitignore | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
ratio library
Header-only, constexpr library providing exact representation for rational numbers.
Relative to std::ratio:
- Uses
constexprinstead of creating new types. This means it can be used seamlessly at runtime. - Supports a few more arithmetic operations, for example exponentiation to integer powers.
- Provides constexpr conversion to fixed-capacity strings (using xo-flatstring)
- Provides concept support (with c++20)
- Requires modern (c++17) support to achieve this
Relative to boost::ratio:
- Streamlined, assumes modern compiler support
Getting Started
install dependencies
- github/Rconybea/xo-cmake cmake macros
- github/rconybea/xo-indentlog logging (used by unit tests)
- github/Rconybea/xo-flatstring fixed-capacity strings
clone xo-ratio
$ cd ~/proj # for example
$ git clone https://github.com/Rconybea/xo-ratio
build + install
$ cd xo-ratio
$ PREFIX=/usr/local # for example
$ BUILDDIR=.build # for example
$ make ${BUILDDIR}
$ cmake --build .build
$ cmake --install .build
build with unit test coverage
$ cd xo-ratio
$ mkdir .build-ccov
$ cmake -DCMAKE_BUILD_TYPE=coverage -B .build-ccov
$ cmake --build .build-ccov
run coverage-enabled unit tests
$ cmake --build .build-ccov -- test
generate html+text coverage report
$ cmake --build .build-ccov -- ccov
browse to .build-ccov/ccov/html/index.html
LSP support
$ cd xo-ratio
$ ln -s .build/compile_commands.json