Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] check if quantities are convertible one into the other
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-12-15 17:24:50


AMDG

On 12/15/2010 11:10 AM, alfC wrote:
>> The ability to test for a conversion is liable to result in
>> ODR problems. On the other hand, the errors are
>> pretty horrendous right now.
> I am not sure how ODR applies here.

is_convertible would depend on which headers
are #included. This makes ODR violations really easy.

> But I guess a compile time check will
> have the same limitations are the conversion itself. After all in the same
> way the constructor
>
> quantity1(q2) is defined, so should be an hypothetical
> is_convertible<quantity1, quantity2>::static_value.
>
> Just a though: for example, can the BOOST_UNITS_DEFINE_CONVERSION_FACTOR add
> some kind of is_convertible trait at the same time? (I know, it won't be
> useful for derived conversions).
>

In Christ,
Steven Watanabe


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