Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-06-05 11:49:58


AMDG

Torsten Maehne wrote:
>>> * All checks involving the multiplication/division of
>>> boost::units::unit and boost::units::absolute<boost::units::unit>
>>> types are not compiling. The compiler complains about ambiguous
>>> overloads for operator* and operator/ (originating from Boost.Units
>>> and Boost.Lambda). Therefore they are currently commented out.
>>>
>>>
>> These shouldn't compile.
>>
>
> I modified the checks so that now units and absolute units are passed as
> well as arguments to the lambda expressions. Then the ambiguous overload
> errors disappear. However, for the absolute unit tests:
> <snip>
>
> I left the non-compiling commented-out tests in place for documentation
> purposes.
>

I looked at the tests. I misunderstood what you were testing.
Allowing multiplication _1 * meters e.g. would require disambiguating
overloads.

>>> * The check of unit<Dim1, System1> - unit<Dim2, System2> is not
>>> compiling. The compiler finds no matching definition of operator-.
>>>
>>>
>> Again these shouldn't compile.
>>
>
> This strikes me as being inconsistent, because it works for:
>
> unit<Dim1, System1> + unit<Dim2, System2>
>

I see. I didn't understand what you were testing, again.
The problem is in units/lambda.hpp line 390 ff.

    /// Partial specialization of return type trait for action
    /// unit<Dim1, System1> - unit<Dim2, System2>.
    template<typename Dim1, typename Dim2, typename System1, typename
System2>
    struct plain_return_type_2<arithmetic_action<minus_action>,
                               boost::units::unit<Dim1, System1>,
                               boost::units::unit<Dim2, System2> > {
        BOOST_STATIC_ASSERT((boost::is_same<System1, System2>::value ==
true));
        typedef typename boost::units::subtract_typeof_helper<
            boost::units::*quantity*<Dim1, System1>,
            boost::units::*quantity*<Dim2, System2> >::type type;
    };

These two quantities ought to be units.

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