Boost logo

Boost :

From: Lewis Hyatt (lhyatt_at_[hidden])
Date: 2007-03-29 18:35:43

Eric Lemings wrote:

>> quantity<SI::length> l1(2.0 * SI::meters);
>> quantity<SI::length> l2(2.0 * Astro::parsecs); //for illustration only
> I would express that differently:
> quantity<SI::length> l1 (quantity<SI::meter>(2.0));
> quantity<SI::length> l2 (quantity<Astro::parsecs>(2.0)); //for
> illustration only
> And I could be way off base here but the latter form would appear more
> familiar/acceptable to most C++ programmers.

I think it is perfectly natural to think of units as having their own
algebra, and so the multiplication notation makes sense. How would you
do something like this:

quantity<velocity> v(2.0 * meters/second);

in your method? I think you'll find that this one is preferable.


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