Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2004-01-09 10:29:52

> to avoid issue with "Unit1 operator + (Unit1 u1, Unit2 u2)"
> some kind of "expression templates" could be applied.
> operators like "+-*/" will return a compile time proxy object
> and in assign operator for unit it'll be converted in the type of this
> unit.

The problem with this sort of approach as I see it is that there is
still ambiguity as
to which unit system to convert to in an expression containing multiple
mixed units :

Consider :

x meters + (y planck_length - z centimeters) ->

furlongs z = proxy<op<plus,meters,op<minus,planck_length,centimeters> >

Do we convert y and z to meters, x and z to planck_lengths, or x and y
to centimeters before
the arithmetic and conversion to furlongs? The outcomes can be
different, as has been discussed earlier, due to precision issues.

Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
801-587-9413 (work)
801-585-3592 (fax)
801-706-5760 (cell)
801-484-0811 (home)
mschabel at ucair med utah edu

Boost list run by bdawes at, gregod at, cpdaniel at, john at