Boost logo

Boost :

From: Rene Jager (renej_at_[hidden])
Date: 2001-04-13 07:18:56

i'd like to throw in my 2 cents...

we use a template-based SI physical type (from some book, can look it up):

namespace si {
template <class T, int mass_index, int length_index, time_index, temp_index,
    int lum_index, angle_index> // we left out steradian
class physical { typedef T value_type; ... };
// specialized physical<0,0,...,0> -> dimensionless, free convertable from/to
} // si

predefined: mass (kilogram), length (meter), time (second), thermodynamic
temperature (kelvin), electric current (ampere), luminous intensity (candela),
angle (meter/meter)
and a whole list of derived units (potential (volt), velocity (meter/second)

typedef physical<0,1,0,..,0> length;
typedef physical<0,0,1,0,...,0> time;
typedef physical<0,1,-1,0,..,0> velocity;
velocity v = length(2)/time(2) // the division will result in a
v = time(1); // compiler error

using this is, all implementations of physics related stuff is checked by the
in the sense that the compiler does not allow to assign a velocity to a length
for example
we apply this in our AGV control software

i don't know if there already is something like this available in boost or
already proposed;
i can upload a version (not boostified) if someone is interested; free license
is no problem


//*** Rene Jager - renej_at_[hidden] - ***/

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