![]() |
Home | Libraries | People | FAQ | More |
By using MPL metafunctions and the template specializations for operations
on composite dimensions (defined in boost/units/dimension.hpp
)
it is possible to perform compile time arithmetic according to the dimensional
analysis rules described above
to produce new composite dimensions :
typedef mpl::times<length_dimension,mass_dimension>::type LM_type; typedef mpl::divides<length_dimension,time_dimension>::type L_T_type; typedef static_root< mpl::divides<energy_dimension,mass_dimension>::type, static_rational<2> >::type V_type;
outputting (with symbol demangling, implemented in utility.hpp)
length_dimension = list<dim<length_base_dimension, static_rational<1l, 1l> >, dimensionless_type> mass_dimension = list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimensionless_type> time_dimension = list<dim<time_base_dimension, static_rational<1l, 1l> >, dimensionless_type> energy_dimension = list<dim<length_base_dimension, static_rational<2l, 1l> >, list<dim<mass_base_dimension, static_rational<1l, 1l> >, list<dim<time_base_dimension, static_rational<-2l, 1l> >, dimensionless_type> > > LM_type = list<dim<length_base_dimension, static_rational<1l, 1l> >, list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimensionless_type> > L_T_type = list<dim<length_base_dimension, static_rational<1l, 1l> >, list<dim<time_base_dimension, static_rational<-1l, 1l> >, dimensionless_type> > V_type = list<dim<length_base_dimension, static_rational<1l, 1l> >, list<dim<time_base_dimension, static_rational<-1l, 1l> >, dimensionless_type> >