Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-01-06 18:19:22

Jan Langer wrote:
>Andy Little wrote:
>>Yep ... Dont have a clue what this SIUnits syntax is about:
>>Length L = 5 * meters ;
>>I tend to assume that operator * means multiply... Nope apparently not in
>i do not really know what you mean, but 5 * meter(s) looks very natural to
>me. a scalar factor 5 is multiplied to a length of a meter, which results
>in a length of 5 meters. if you have an implicit value_type and if you
>assume to be solely in a specific units system, the syntax
> length l = 5*meters;
>expresses all facts.

The SIUnits syntax is borrowed from Physics notation, e.g. acceleration is
usually m/s(-2). Thus, acceleration caused by Earths gravitational pull can
be expressed as:
   Acceleration g = 9.2 * m / ( s * s );
This allows for a clean expression of physical information in the way that
is most like the Physics notation, making it more readible to the programmer
and allows the compiler to apply compile-time type checking, ensuring that
you don't do something silly like:
   Speed s = 2 m / s;
   // ...
   s = g; // oops! picked up at compile time :)


Sign-up for a FREE BT Broadband connection today!

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