Boost logo

Boost :

From: Eric Lemings (lemings_at_[hidden])
Date: 2007-03-29 16:49:35


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Matthias Schabel
> Sent: Thursday, March 29, 2007 1:56 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] units: review
> Here's the reasoning for this syntax :
> quantity<SI::length> represents a quantity of length in the SI
> system, not a generic length.

Think I understand your rationale now. Your goal is to deal with the
scaling problem to accommodate measurements of different magnitudes
(e.g. subatomic quantities vs. cosmic quantities)?

Not certain this is the best solution but if it works...

> Because everything is specified at
> compile time, units and quantities must be completely defined,
> otherwise it would be impossible to achieve zero runtime
> overhead. In
> this usage, meter is, in fact, completely equivalent to SI::length()
> - it is just a static constant. Another possibility would have been
> something like this : quantity<SI::meter> q(2*SI::meter());

Hmm. I still don't understand the rationale for the extra
operation. How is this any different from:

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

> Furthermore, in the
> current syntax, if you had a program that used a bunch of SI units
> and you wanted to change it to CGS, you could just search and
> replace

Ack! Search and replace? How about this instead:

using namespace CGS;

After all, that's the whole point for using namespaces.


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