
Boost : 
From: Matthias Schabel (boost_at_[hidden])
Date: 20040107 17:03:01
> My major Major criticism of all the other units libs is "Heres My Great
> Lib..."
> then there are a couple of headers of template code
> followed by 'Oh ...BTW... you have to define your own units... dont
> worry
> it'll be no problem' .
> My reaction as a user is ... What the ( expletive deleted) is this (
> expletive deleted) ?
I'm going to assume that you either a) haven't bothered to look at the
example program I provide with YANL or b) don't mean to include it in
your "all the other units libs" category as it already (and has pretty
much from the outset) fully supports all common SI units as well as a
subset of the CGS unit system. For example, this code works as
expected :
template<class Y>
dimensioned_quantity<Y,dimensioned_unit<si_model,quantity_type> >
idealGasLaw(dimensioned_quantity<Y,dimensioned_unit<si_model,pressure_ty
pe> > P,
dimensioned_quantity<Y,dimensioned_unit<si_model,volume_type> > V,
dimensioned_quantity<Y,dimensioned_unit<si_model,temperature_type> > T)
{
return (P*V/(8.314*(_joules/(_kelvin*_mole))*T));
}
// test ideal gas law
SI<double>::temperature T = (273.+37.)*_kelvin;
SI<double>::pressure P = 1.01325e5*_pascals;
SI<double>::length r = 0.5e6*_meters;
SI<double>::volume V = (4.0/3.0)*3.141592*power<3>(r);
SI<double>::quantity n(idealGasLaw(P,V,T));


Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
8015879413 (work)
8015853592 (fax)
8017065760 (cell)
8014840811 (home)
mschabel at ucair med utah edu
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk