Tag: si++

SI++ library

Inspired by std::chrono idea, I wrote a small header-only library using modern C++ for strongly-typed unit metrics, mostly for distance and speed.

#include <sipp/sipp.hpp>

// ...

using namespace sipp::literals;

auto distance_in_km = 100.0_km;
sipp::Feet distance_in_feet = distance_in_km;

std::cout << "Distance in kilometers: " << distance_in_km.count() << std::endl;
std::cout << "Distance in feet: " << distance_in_feet.count() << std::endl;

auto casted = sipp::distance_cast<sipp::Meters>(5 * distance_in_km);
std::cout << "Multiplied kilometers and cast to meters: " << casted.count() << std::endl;

See more details in README.