From: Andy Little (andy_at_[hidden])
Date: 2004-01-10 16:55:06
"Matthias Schabel" <boost_at_[hidden]> wrote in message
> >> // test ideal gas law
> >> SI<double>::temperature T = (273.+37.)*_kelvin;
> >> SI<double>::pressure P = 1.01325e5*_pascals;
> >> SI<double>::length r = 0.5e-6*_meters;
> >> SI<double>::volume V = (4.0/3.0)*3.141592*power<3>(r);
> >> SI<double>::quantity n(idealGasLaw(P,V,T));
How about ...
q_temperature::K T(273. + 37.);
q_volume::m3 V = (4.0/3.0) * 3.141592 * power<3>(r);
> const R(8.314); // gas-constant J.mol-1.K-1
q_substance::mol subst = P * V / (R * T);
I have opted to apply the units at compile time.
Then I can do this:
typedef std::complex<q_resistance::R> impedance;
impedance Z = V / I;
I hope I can get that working in my next version.
> > BTW I looked into your ct problems. VC 7.1 has some neat
> > specialisations.
> > (Doesnt work on gcc)
> > have you tried masks?
> > Basically 7 dimensions --> 127 (I think) mask possibilities
> > If interested Will try to look out the code.
> Not sure how that will help with user-defined quantities outside of SI.
Don't know, but thought it had some flavour of what you are after.
Its basically a hashmap, with the mask as the hash code.
That may be better than a map. Of course a hashmap is bigger
than a map(exemplified by big header in this case...which is trivial)...
but much faster.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk