Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2007-03-07 15:06:28


Here's some code demonstrating point and vector quantity conversions
for Fahrenheit->Kelvin (unit_example_20.cpp). This code works correctly
and is included in the most recent release of mcs::units in the Vault
(mcs_units_v0.7.0_alpha_7)... The point<> and vector<> classes are toys
for demo purposes only.

        quantity<fahrenheit::temperature,point<> > T1p(point<>(32)
*fahrenheit::degrees);
     quantity<fahrenheit::temperature,vector<> > T1v(vector<>(32)
*fahrenheit::degrees);

        quantity<SI::temperature,point<> > T2p(T1p);
     quantity<SI::temperature,vector<> > T2v(T1v);

     std::cout << T1p << std::endl
               << T2p << std::endl
               << T1v << std::endl
               << T2v << std::endl
               << std::endl;

Outputting :

{ 32 } F
{ 273.16 } K
[ 32 ] F
[ 17.7778 ] K

The main shenanigans happen in the specialization for conversion_helper
to point and vector quantities of temperatures...

Matthias

----------------------------------------------------------------
Matthias Schabel
2859 Glen Oaks Drive
Salt Lake City, UT 84109
801-706-5760 (cell)
801-484-0811 (home)
matthias at stanfordalumni dot org
----------------------------------------------------------------




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk