|
Boost : |
From: Peder Holt (peder.holt_at_[hidden])
Date: 2007-01-15 03:20:30
<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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk