
29 Mar
2007
29 Mar
'07
10:35 p.m.
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. -Lewis