
The type-deduction respects references. Phoenix2 passes in references. The code should be:
template<> //in general template
struct result_of_multiplies si::length&, quantitysi::length&> { typedef quantitysi::area type; };
::type type; }; template
struct result_of_multiplies &, Y&>{ typedef typename multiply_typeof_helper &,Y& ::type type; }; template struct result_of_divides { typedef typename
can you believe it?, I tried with 'const &' but not '&'!!!
Thank you so much for your help. Boost.Units and Boost.Interval will
be good benchmark test for the type deduction of Phoenix3
(what will be the magic of P3? use of typeof?)
Below it is a bridge code between phoenix2 and units.
Notes:
1) Not sure about the reference '&' in the typedefs, put them there
for symmetry.
2) result_of_plus/minus don't seem to be necessary
3) todo: overload operator*(actor<T>, quantity<...>) and
operator*(actor<T>, unit<...>) and reversed to overcome ambiguity on
operator*.
4) todo: specialize *=, /=
5) I wish this be in boost/units/phoenix2.hpp.
// phoenix2 units bridge, result_of_plus/minus don't seem to be
necesary, todo: *=, /=
namespace boost{
namespace phoenix{
using namespace boost::units;
template
::type type; }; template
struct result_of_divides &, Y&>{ typedef typename divide_typeof_helper &, Y&>::type type; }; }}