
15 Jan
2007
15 Jan
'07
8:20 a.m.
<snip>
and the FPType default to double? (Since nearly all work will be done using double, it would be nice to avoid typing/seeing double so often in the code. It would be much nicer to write
quantity<length> L = 2.0 * meters; // quantity of length
to get double?
quantity<float, length> L = 2.0 * meters; // quantity of length
to get float, but order makes this impossible.
Not impossible, just add another layer of indirection: template<typename T1,typename T2> class quantity : public quantity_impl< typename mpl::if_< is_unit<T1>,T2,T1
::type, typename mpl::if_< is_unit<T1>,T1,T2 ::type {};
Peder