|
Boost : |
Subject: Re: [boost] Boost.units autoscaling doesn't seem to work with the measurement type.
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2012-04-27 09:28:35
> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Paul A.
> Bristow
> Sent: Thursday, April 26, 2012 6:29 PM
> To: boost_at_[hidden]
> Subject: [boost] Boost.units autoscaling doesn't seem to work with the measurement type.
>
> I have previously used Boost.Units and autoscaled using << engineering_prefix nicely, and this
works as
> expected for quantity of type double.
>
> but it seems that code that I believe worked previously does not autoscale when using a
*user-defined
> type*, like the measurement example in kitchen_sink.cpp.
>
> To confirm this, I have added after //[kitchen_sink_snippet_8 in kitchen_sink.cpp at line 445
>
> a measurement quantity where the length is long enough to trigger conversion to km, thus
>
> quantity<length,measurement<double> > biglen(measurement<double>(12345.0,123.0)*meters);
> std::cout << "Biglen autoscaled "<< engineering_prefix << biglen << std::endl;
>
> but I get a *unscaled* value :-(
>
> Biglen autoscaled 12345(+/-123) m
>
> rather than the expected conversion to kilometers
>
> 12.345(+/- 0.123) km
I have re-run this on an old machine using VS2008 and a pre-release version of autoprefix dated
about Mar 2010 and
If include I:\units_autoprefix as the source of units code
quantity<length,measurement<double> > big_len(measurement<double>(123456.0,1234.0)*meters);
std::cout << engineering_prefix << big_len << std::endl;
outputs the desired autoscaled values
123.456(+/-1.234) km
Wishing to avoid where angels fear to tread, I have not tried to examine differences between the
versions ;-)
Please tell me if I can provide any more information.
Paul
--- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk