Boost logo

Boost :

Subject: Re: [boost] Unittest capability for meta-programs feedback request
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-09-28 10:22:17


AMDG

On 09/27/2011 11:06 PM, Ben Robinson wrote:
> The required modification to Boost Unit, was to add the following templated
> constructor to boost::units::quantity:
>
> template <class rhs_type>
> quantity(const rhs_type& source) : val_()
> {
> BOOST_METATEST_MSG(false,
> INVALID_CONVERSION_BETWEEN_INCOMPATIBLE_UNITS, (this_type, rhs_type));
> }
>
> In the unmodified library, the lack of this constructor would produce the
> compiler error, when an incorrect assignment requiring this constructor was
> made. This makes an interesting point, that I have written additional code
> to *explicitly* express the intended failure consequence of invoking this
> constructor, instead of relying *implicitly *on the lack of such a
> definition.
>

Unfortunately, this changes the behavior of
the library. is_convertible<Q1, Q2> will return
true if the units are unrelated. It can also
change the result of overload resolution.

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