Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-05-16 05:33:28


"Gerhard Wesp" wrote

> Physics gives quite clear directions as to which operations a time type
> must support:
> - Addidtion, subtraction, comparison with other time's.
> - Division by other time's to give a dimensionless type.
> - Conversion to/from whatever is useful, maybe stream operators.
>
> Note that any builtin arithmetic types support those operations, but
> they're not "typesafe" in the sense that you might end up e.g. adding
> time and length. A user-defined type can protect you from those
> accidents by only defining the above mentioned operations.
>
> *If* we want a user-defined type to represent time, it may well be part
> of a general framework for physical quantities. See e.g.
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1451.html,
> section 6 for ideas on how this can be done.

BTW It might be useful to point out that my Physical Quantities library 'pqs' ,
which provides the above operations, is up for Formal Review by Boost at some
time in the near future:

http://tinyurl.com/7m5l8

(I hope that 'pqs_3_1_0' in that directory will be the review version, but that
will be subject to my Review Managers approval. If all is in order then I hope
that the review dates for pqs will be confirmed soon).

regards
Andy Little


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