Boost logo

Boost :

From: Eric Lemings (lemings_at_[hidden])
Date: 2007-03-29 17:46:01


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Matthias Schabel
> Sent: Thursday, March 29, 2007 2:50 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] units: review

You're starting to raise more questions than you're answering. ;)

> > Hmm. I still don't understand the rationale for the extra
> > multiplication
> > operation. How is this any different from:
> >
> > quantity<SI::meter> q(2);
> It's a faux operation - the multiplication of a scalar times a unit
> (a class with no data members at all) decorates the scalar to
> produce
> a quantity of the appropriate unit and value type. The problem with
> using a raw value type for construction can be demonstrated here :

It's not a faux operation: the unit is already plainly specified as part
of the type and the value of the quantity is plainly specified as the
constructor argument. Pretty straight forward if you ask me.

> using namespace SI;
> /// this is two meters
> quantity<length> q(2);

First of all, that code should fail to compile. Ignoring the comment,
it is (or should be) impossible to construct a quantity with a length
of 2. The unit must be specified to the compiler somehow and comments
don't count.

That is why I distinquished a quantity from a measure in my preview of
last year: a quantity is an abstract value that is qualified with one or
more dimensions and cannot be constructed directly from arithmetic
A measure on the other hand accepts a list of units and therefore can be
constructed directly from an arithmetic value. A measure can also be
converted to a compatible quantity and vice versa.


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