Boost logo

Boost :

From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 2003-10-24 10:04:25


Jeff Flinn wrote:

>> > Matthias Troyer wrote:
>> >> Is it possible to have a floating point number as a template
>> >> parameter?

>> I thought that the standard (14.1.4) says:
...
>> which would exclude floating point numbers
>
> Back to rationals then?
>

if we have

   quantity<NumericType, Unit, Dimension>

then we can have a trait to determine whether or not the Unit has any
sort of trnsform asociated with it. The Unit could then provide the
(possibly static) functions required to perform the transform.

if in addition we use inheritance

   quantity<NumericType, Unit, Dimension>
     : Unit
   {}

Then runtime units are also enabled.

Hugo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk