
Boost : 
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 20080606 12:01:52
AMDG
Torsten Maehne wrote:
> I have tried to add specializations to lambda.hpp like the following:
>
> /// Partial specialization of return type trait for action
> /// boost::lambda::functor<T> * unit<Dim, System>.
> template<typename System, typename Dim, typename T>
> struct plain_return_type_2<arithmetic_action<multiply_action>,
> boost::lambda::lambda_functor<T>,
> boost::units::unit<Dim, System> > {
> typedef typename boost::units::multiply_typeof_helper<
> boost::lambda::lambda_functor<T>,
> boost::units::unit<Dim, System> >::type type;
> };
>
> , to disambiguate the overloads. However the specialization seems to be
> not picked up by the compiler  it still uses either:
>
> boost::lambda::functor<T> * Y
>
> or
>
> Y * unit<Dim, System>
>
> when uncommenting the check for bl::_1 * bu::meters in test_lambda.cpp.
> (Note: I didn't add the specialization to the attached corrected
> lambda.hpp.) Do you have an idea, what I'm doing wrong here?
>
Yes. The correct solution is to add overloads for the operators, rather
than specializations
of plain_return_type_2.
template<typename System, typename Dim, typename T>
... operator*(const boost::lambda::lambda_functor<T>&, const
boost::units::unit<Dim, System>&);
You'll have to peek at the internals of lambda to figure out what the
return type should be.
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