Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] check if quantities are convertible one into the other
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-12-15 14:10:50


> 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. 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).

> This is a fairly common
> problem. Could you file a trac ticket. I'll try to make the
> error more readable.

sure, https://svn.boost.org/trac/boost/ticket/4988

A better error message will help a lot in this and other contexts but think
it is a different issue with respect to the is_convertible<quantity1,
quantity2> feature.

Thank you,

Alfredo



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