Skip to content

SI unit library. Provides types and functionality to support compile-time dimentional analysis checking.

Notifications You must be signed in to change notification settings

mercator-rejection/si

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is it?

This library provides a single type that can be used to represent any physical SI unit. It provides automatic type safety by ensuring values of differing types can not be operaterated on in illegal ways. For instance, distance + velocity would generate an compile-time error; where as distance + velocity * time is a legal expression.

Example

auto position = Meter<float>(15);
auto velocity = Velocity<float>(10);
auto time     = Second<float>(2);

auto fubar  = position + velocity; //<-- Compilation error
auto result = position + velocity * time;

std::cout << float(result); // "45"

About

SI unit library. Provides types and functionality to support compile-time dimentional analysis checking.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages