Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] easier "power" of units generation
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-05-06 10:48:47


AMDG

alfC wrote:
> I have a custom units, for example, angstrom:
>
> typedef scaled_base_unit<si::meter_base_unit, scale<10,
> static_rational<-10> > > angstrom_base_unit;
> typedef metric::angstrom_base_unit::unit_type angstrom_unit;
> static const angstrom_unit angstrom;
>
> and I have a quantity
>
> quantity<angstrom_unit> L=1.*angstrom;
>
> and I want to have a variable that has dimensions of volume and
> angstrom^3 units:
>
> ??? V = pow<3>(L);
>
> ¿how can I generate the type of V, given angstrom_unit?
>

The metafunction is power_typeof_helper.

quantity<power_typeof_helper<angstrom_unit, static_rational<3> >::type> V;

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net