Boost logo

Boost :

From: Eric Lemings (lemings_at_[hidden])
Date: 2007-03-29 15:48:45


 

> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Matthias Schabel
> Sent: Thursday, March 29, 2007 11:27 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] units: review
>
...
> units. The original rationale was that
>
> quantity<SI::length> q = 2*meters;
>
> reads a bit better than
>
> quantity<SI::length> q = 2*meter;

I'm confused by this syntax. The intent here is to assign a quantity of
2 meters to an "anonymous" quantity of length, correct? If so, wouldn't
the following syntax make more sense?

quantity<SI::length> q = quantity<SI::meter>(2);

The "2*meters" syntax just seems rather obscure. Likewise, a "measure",
a quantity with a specified unit, should be constructed without the need
for qualification.

quantity<SI::meter> q (2);

That is, the "2*meters" should not be required when the unit is already
explicitly specified as part of the type.

By the way, while meter is an SI unit and therefore belongs in the SI
namespace, length is not an SI dimension hence the name "length" does
not belong in the SI namespace. It should probably be elevated to the
boost::units namespace. I don't believe there is such a thing as an "SI
dimension"; i.e. other system of measurement (e.g. Imperial) have units
of length as well.

Eric.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk