Boost logo

Boost Users :

Subject: Re: [Boost-users] [Units] help with type-safe unit-specific conversions
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-07-23 15:24:09


AMDG

Justin Leonard wrote:
> Steven Watanabe <watanabesj <at> gmail.com> writes:
>
>> If you substitute the correct unit types in place of the
>> enum values in quantity<xxx>(some_value).value(),
>> then the code above should work fine.
>>
>
> So I should be able to do something like:
>
> double length_in_feet = quantity<us::foot_base_unit>(10.0*si::meters).value();
>
> to explicitly convert from meters to feet? Right now this gives
> 'boost::mpl::assertion_failed' while compiling quantity.hpp.
>

It asserts because a base_unit is just a tag type.
Try us::foot_base_unit::unit_type.

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