Units - MichaelMiller-/sec21 GitHub Wiki

sec21::units

Is a modern, lightweight library for dimensional analysis. Inspired by Boost-Units and Boost-MPL. In order to be able to use their full range of functions, only one include is required.

#include <sec21/units.h>

The library is also very easy to expand. If a dimension is missing, it can be created very easily and made known to the system. The following is an example of pressure, the dimension of which is equal to M L^-1 T^-2.

using pressure = dimension<
   exponent<base_dimension_mass, 1>, 
   exponent<base_dimension_length, -1>,
   exponent<base_dimension_time, -2>>;

The basic dimensions represent freely chosen compiletime constants. The procedure is similarly simple for new units. These just have to be defined and derived from derived_unit.

struct pascal : derived_unit<pascal, pressure, base_unit> {};
struct kilopascal : derived_unit<kilopascal, pressure, std::kilo> {};
// ...

Dependencies

⚠️ **GitHub.com Fallback** ⚠️