|
Boost : |
Subject: Re: [boost] [units] problems
From: Robert Ramey (ramey_at_[hidden])
Date: 2013-09-13 18:48:41
Steven Watanabe wrote:
> AMDG
>
> On 09/13/2013 01:54 PM, Robert Ramey wrote:
>> <snip>
>> What I expect to see is:
>>
>> #include <boost/units/quantity.hpp>
>> #include <boost/units/systems/si/length.hpp>
>> #include <boost/units/base_units/us/mile.hpp>
>> void main(){
>> using namespace boost::units;
>> using namespace boost::units::si;
>> using namespace boost::units::us;
>> quantity<length, float> l1;
>> l1 = 1000.0 * meters;
>> quantity<length, float> l2;
>> l2 = 1.0 * miles; // compile error
>> quantity<length, float> l3 = l1 + l2;
>> }
>>
>> and I expect this to pretty much work. The documentation says "
>> Implicit conversions between unit systems are allowed only when the
>> reduced units are identical, allowing, for example, trivial
>> conversions between equivalent units in different systems (such as
>> SI seconds and CGS seconds)" so I expected that it can convert miles
>> into kilometers.
>
> Try static_cast.
could you give me an example? That is how should the statement
l2 = 1.0 * miles; // compile error
be modified?
>> This is a
>> disappointment - but I'll assume that the authors have a good reason
>> for this.
>>
>> <snip>
>>
>
> In Christ,
> Steven Watanabe
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk