Skip to content

crayzeewulf/ScientificQuantities

 
 

Repository files navigation

ScientificQuantities

A template based C++11 class for definition and conversion of scientific quantities.

The base class is based on SI unit. From these we derive the "Derived SI units". All the BASE and DERIVED using are implemented. See https://en.wikipedia.org/wiki/International_System_of_Units#Units_and_prefixes

I created this class so I would avoid having to keep track of what units is being used across my code. These classes do the following:

  • They explicitely enforce the programmer to assign a unit when creating a variable: Angle a1 = 90_deg; Angle a2 = 1.2_rad;
  • They prevent you from incorrectly performing calculations between units; what is kg⋅m2⋅s−3⋅A−1? WATT!! This is correct but K⋅m probably not!
  • They do the conversions for you: Length l1 = 120_m; l1.in(km) => 0.12; Length l1 = 120_m + 33_cm;

About

A C++11 template class to deal with units inside the program

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%