Boost logo

Boost :

Subject: Re: [boost] [units] problems
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-09-13 19:56:02


AMDG

On 09/13/2013 03:48 PM, Robert Ramey wrote:
> Steven Watanabe wrote:
>> On 09/13/2013 01:54 PM, Robert Ramey wrote:
>>> <snip>
>>> 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;
>>> }
>>>
>>> <snip>
>>
>> Try static_cast.
>
> could you give me an example? That is how should the statement
>
> l2 = 1.0 * miles; // compile error
>
> be modified?
>

l2 = static_cast<quantity<length, float>>(1.0 * miles);

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk