Boost logo

Boost :

From: Gerhard Wesp (gwesp_at_[hidden])
Date: 2006-06-08 12:50:59


On Wed, Jun 07, 2006 at 08:42:14PM +0100, Andy Little wrote:
> typedef double length;
> typedef double mass;

Well, of course I am speaking of types such that the expression

mass x = foot/second;

a compile-time error.

IOW, for me a physical quantity would just be the bare
template< int mass, int time, int distance, /* rest of 7 SI base units */ >
class pq {
  double value;
};

(add all the necessary construcors, accessors, operators, etc...; may
also be templated on the value type.)

I believe the rest of a PQ library can be created around this template.

Regards
-Gerhard

-- 
Gerhard Wesp
ZRH office voice: +41 (0)44 668 1878
ZRH office fax: +41 (0)44 200 1818
For the rest I claim that raw pointers must be abolished.

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