Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Scaled Base Units

Now, it is also possible to define a base unit as being a multiple of another base unit. For example, the way that kilogram_base_unit is actually defined by the library is along the following lines

struct gram_base_unit : boost::units::base_unit<gram_base_unit, mass_dimension, 1> {};
typedef scaled_base_unit<gram_base_unit, scale<10, static_rational<3> > > kilogram_base_unit;

This basically defines a kilogram as being 10^3 times a gram.

There are several advantages to this approach.


PrevUpHomeNext