|
Boost : |
Subject: Re: [boost] Units of data
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-07-02 15:25:23
AMDG
Matthias Schabel wrote:
>> //Succeeds but gives a horribly long warning about conversion from
>> 'double' to 'const int'
>> //at file 'boost/units/detail/conversion_impl.hpp(342)',
>> reference to
>> class template instantiation at
>> //boost/units/quantity.hpp(182)
>> quantity<data_capacity, int> compressed_size3(1000 * bytes);
>> }
>
> If I remember correctly, this stems from the use of double precision
> in the conversion code. I think it would be difficult to get rid of
> this - most computations involving unit conversions do not involve
> exact integer arithmetic...
Getting rid of the warning shouldn't be a problem.
I'm just going to add a cast. This ought to be safe,
since the conversion is explicit. A cast is only
needed at the end, because all the conversion code
is careful to deduce the correct return type for all
operators.
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