From: Eric Lemings (lemings_at_[hidden])
Date: 2007-03-29 19:08:38
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Lewis Hyatt
> Sent: Thursday, March 29, 2007 4:36 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] units: review
> 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.
quantity<velocity> v1 (quantity<meter>(2) / quantity<second>(1));
The problem with the "multiplier" usage is it uses a unit name (plural,
singular, whatever) for both type information and rvalue expressions.
quantity<second[s]> t1 (2.0 * second[s]);
This usage may be preferable to scientists and engineers but not C++
programmers, I'll gar-on-tee.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk