Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 495 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 495 Bytes

C++ Units

The units and demensions header-only library for C++.

C++ 20 is required.

Example:

#include "../cpp-units/cpp-units.hpp"

using namespace cpp_units::literals;

int main() {
    constexpr auto v1 = 1_m;
    constexpr auto v2 = 20_mm;
    constexpr auto v3 = v1 - v2; // 980 mm
    constexpr auto v4 = v1 / v2; // 0
    constexpr auto v5 = v1 * v2; // 20 m*mm

    return 0;
}

Tests

cd /path/to/repo
mkdir build
cd build
cmake ..
cmake --build .
ctest .