Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix][units] make boost.phoenix play well with boost.units
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-07-16 15:23:26


On Jul 16, 3:09 am, Alfredo Correa <alfredo.cor..._at_[hidden]> wrote:
> namespace boost{
> namespacephoenix{
> #define RESULT_OF_QUANTITY_UNITS_GEN( PhoenixopnamE, UnitsopnamE ) \
> template<class XUnit, typename TX, class Dim, class System> \
> struct result_of_##PhoenixopnamE < \
>         boost::units::quantity<XUnit,TX> &, \
>         boost::units::unit<Dim, System> \>{ \
>
>         typedef \
>                 typename boost::units::UnitsopnamE##_typeof_helper< \
>                         boost::units::quantity<XUnit,TX>, boost::units::unit<Dim, System> \
>                 >::type type; \};
>
>         RESULT_OF_QUANTITY_UNITS_GEN(multiplies, multiply)
>         RESULT_OF_QUANTITY_UNITS_GEN(divides   , divide  )
> #undef RESULT_OF_QUANTITY_UNITS_GEN
>
this is a bit more generic:

#define RESULT_OF_QUANTITY_UNITS_GEN( PhoenixopnamE, UnitsopnamE ) \
template< \
        typename X, \
        class Dim, class System> \
struct result_of_##PhoenixopnamE < \
        X&, \
        boost::units::unit<Dim, System> \
>{ \
        typedef \
                typename boost::units::UnitsopnamE##_typeof_helper< \
                        X, \
                        boost::units::unit<Dim, System> \
>::type type; \
};
        RESULT_OF_QUANTITY_UNITS_GEN(multiplies, multiply)
        RESULT_OF_QUANTITY_UNITS_GEN(divides , divide )
#undef RESULT_OF_QUANTITY_UNITS_GEN


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