
Boost : 
From: Paul A. Bristow (boost_at_[hidden])
Date: 20031016 03:26:44
 David Abrahams wrote:
 > David Richardson wrote:
 >
 >> Deane Yang wrote:
 >>
 >>> c) Automatic generation of new types when two different quantities
 >>> are multiplied or divided
 >>
 >> I'm a bit confused how this would work (maybe because I've been
 >> thinking about this as a physics problem). Do we just pick an
 >> arbtrary rule for the production of new types/units?
 >
 > No, mathematics gives the rules. You can see examples in my slides at
 > http://www.boostconsulting.com/writing/ACCU_MPL_slides.ppt
Very thoughtprovoking  if brainhurting ;)

 The slides have examples where the units are from physics. So you
 represent a number's units as a ntuple of exponents with each
 exponent corresponding to one of the fundamental SI units.
 Arithmetic operations on numbers with these units have well
 defined rules to compute the resulting units.

 If the semantics of the exponents in the ntuple are user defined, ...
<snipped>
Would an example here be if the exponents in the ntuple were of type rational
rather than type integer?
Could this meet the need for fractional dimensions?
(At the cost of making it even more complicated! Especially to ensure it doesn't
have a runtime cost).
Paul
Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
mailto:pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk