
6 Sep
2006
6 Sep
'06
6:20 p.m.
That is, for some arbitrary value types X and Y for which (warning pseudocode ahead)
Z operator+(X x,Y y)
is defined
quantity<Z> operator+(quantity<X> x,quantity<Y> y)
will work and behave as expected...
I need this feature!
If you want to be at the bleeding edge, you can give it a try. I've uploaded this code as Vault/Units/mcs_units_hetero_op.zip. I think it should work on non-g++ compilers (but _without_ heterogenous operator functionality), but no guarantees. Everything except power<N> and root<N> seems to work for me. Try unit_example_6.cpp to get a feel for it... Cheers, Matthias