|
From: Matthias S. <mat...@us...> - 2007-03-29 19:39:29
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11179/example Modified Files: unit_example_1.cpp unit_example_22.cpp unit_example_4.cpp Log Message: remove unnecessary include Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- unit_example_22.cpp 29 Mar 2007 16:45:00 -0000 1.1 +++ unit_example_22.cpp 29 Mar 2007 19:39:28 -0000 1.2 @@ -134,8 +134,8 @@ quantity<CGS::force> F0 = 20 * CGS::dyne; - quantity<SI::force> F1 = quantity_cast<SI::force>(F0); - quantity<SI::force> F2 = quantity_cast<SI::force>(20 * CGS::dyne); + quantity<SI::force> F1 = quantity<SI::force>(F0); + quantity<SI::force> F2 = quantity<SI::force>(20 * CGS::dyne); quantity<SI::force> F3(F0); // quantity<SI::force> F4 = F0; @@ -153,6 +153,29 @@ std::cout << F1 << std::endl; + quantity<SI::length,double> q(1.5*SI::meters); + quantity<SI::length,int> r(2*SI::meters); + quantity<CGS::length,double> s(2.5*CGS::centimeters); + quantity<CGS::length,int> t(3*CGS::centimeters); + + std::cout << q << std::endl + << r << std::endl + << s << std::endl + << t << std::endl + << std::endl; + + q = quantity<SI::length,double>(r); + + std::cout << q << std::endl; + + q = quantity<SI::length,double>(s); + + std::cout << q << std::endl; + + q = quantity<SI::length,double>(t); + + std::cout << q << std::endl; + return 0; } Index: unit_example_4.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_4.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_4.cpp 16 Mar 2007 18:29:53 -0000 1.1.1.1 +++ unit_example_4.cpp 29 Mar 2007 19:39:28 -0000 1.2 @@ -143,6 +143,7 @@ #include <boost/units/io.hpp> #include <boost/units/systems/si.hpp> +#include <boost/units/systems/trig.hpp> #include <boost/units/systems/si/codata/physico-chemical_constants.hpp> #include "measurement.hpp" @@ -151,6 +152,7 @@ namespace units { +/* //[unit_example_4_function_snippet_1 /// sin takes a quantity and returns a dimensionless quantity template<class System,class Y> @@ -172,6 +174,7 @@ return quantity_type::from_value(std::asin(val.value())); } //] +*/ //[unit_example_4_function_snippet_3 /// the physical definition of work - computed for an arbitrary unit system @@ -370,9 +373,9 @@ //[unit_example_4_snippet_6 /// test trig stuff - quantity<angle> theta = 0.375*radians; - quantity<dimensionless> sin_theta = sin(theta); - quantity<angle> thetap = asin(sin_theta); + quantity<angle::radian> theta = 0.375*radians; + quantity<angle::dimensionless_radian> sin_theta = sin(theta); + quantity<angle::radian> thetap = asin(sin_theta); //] sstream1 << "theta = " << theta << std::endl @@ -496,9 +499,9 @@ sstream2 << "no typeof" << std::endl; #endif // BOOST_UNITS_HAS_TYPEOF sstream2 << std::endl; - sstream2 << "theta = 0.375 rd" << std::endl; + sstream2 << "theta = 0.375 rad" << std::endl; sstream2 << "sin(theta) = 0.366273 dimensionless" << std::endl; - sstream2 << "asin(sin(theta)) = 0.375 rd" << std::endl; + sstream2 << "asin(sin(theta)) = 0.375 rad" << std::endl; sstream2 << std::endl; sstream2 << "V = (12.5,0) m^2 kg s^(-3) A^(-1)" << std::endl; sstream2 << "I = (3,4) A" << std::endl; Index: unit_example_1.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_1.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_1.cpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ unit_example_1.cpp 29 Mar 2007 19:39:28 -0000 1.2 @@ -41,7 +41,6 @@ #include <boost/mpl/assert.hpp> -#include <boost/units/sys.hpp> #include <boost/units/detail/utility.hpp> #include "test_system.hpp" |