On Jun 4, 5:55 pm, alfC
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; };
Actually (unfortunately) it seems that all 4 combinations of reference/
no reference are needed.
This is the only way I managed to make these expression work with type
deduction:
arg1*arg1
(arg1*arg1)*arg1
arg1*(arg1*arg1)
(arg1*arg1)*(arg1*arg1)
So, I have to implement this kind of macro sorcery to bridge
Boost.Units and Boost.Phoenix. Not sure if I will find another bump in
the road:
namespace boost{
namespace phoenix{
using namespace boost::units;
#define RESULT_OF_GEN( PhoenixnamE, UnitsnamE, RefQ1, RefQ2 ) \
template
::type type; \ }; RESULT_OF_GEN(multiplies, multiply, &, ) RESULT_OF_GEN(multiplies, multiply, &, &) RESULT_OF_GEN(multiplies, multiply, , ) RESULT_OF_GEN(multiplies, multiply, , &) RESULT_OF_GEN(divides , divide , &, ) RESULT_OF_GEN(divides , divide , &, &) RESULT_OF_GEN(divides , divide , , ) RESULT_OF_GEN(divides , divide , , &) #undef RESULT_OF_GEN }}