Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Dimensionless? expecting length+length
From: Michael (mwpowellhtx_at_[hidden])
Date: 2015-08-10 22:12:05


On August 10, 2015 10:06:43 EDT, Gavin Lambert <gavinl_at_[hidden]> wrote:
>On 11/08/2015 01:43, Michael Powell wrote:
>>> Try normalising the milliseconds to seconds before putting them in
>the rest
>>> of the formula. You should be able to do this simply by assigning
>them to a
>>> seconds quantity type instead of using "auto".
>>
>> I'm not sure what you mean, "seconds quantity type"?
>>
>> There would be quantity<time> ?
>
>Yes. I have this:
>
>typedef quantity<time> Time;
>
>And explicitly use "Time" as the type for all time-related results
>instead of using "auto".
>
>> Which one can assign from (time_value * seconds), to arrive at
>seconds?
>>
>> It is possible to build up a milliseconds unit, or possible a
>> milliseconds_to_seconds "conversion factor" ?
>
>You can, but it's not necessary. Simply assign value * milli * seconds
>
>to a variable of quantity<time> (aka Time) and it automatically
>converts
>everything to seconds (since that's the base unit of "time"). This
>prevents other operations getting confused by scaled units, which
>happens when you use "auto" because it skips this conversion.

Ah I gotcha. So the prevailing wisdom is auto auto auto, except when quantities and prefixed unit conversions are concerned.

Thank you...

>_______________________________________________
>Boost-users mailing list
>Boost-users_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/boost-users

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

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