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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s