![]() |
Home | Libraries | People | FAQ | More |
We can also scale a unit
as a whole, rather than scaling the individual base units which comprise
it. For this purpose, we use the metafunction make_scaled_unit
.
The main motivation for this feature is the metric prefixes defined in boost/units/systems/si/prefixes.hpp
.
A simple example of its usage would be.
typedef make_scaled_unit<si::time, scale<10, static_rational<-9> > >::type nanosecond;
nanosecond is a specialization of unit
,
and can be used in a quantity normally.
quantity<nanosecond> t(1.0 * si::seconds); std::cout << t << std::endl; // prints 1e9 ns