You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(89) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(208) |
Feb
(76) |
Mar
(55) |
Apr
(74) |
May
(43) |
Jun
(116) |
Jul
(109) |
Aug
(46) |
Sep
(36) |
Oct
(106) |
Nov
(159) |
Dec
(128) |
| 2007 |
Jan
(54) |
Feb
(225) |
Mar
(200) |
Apr
(229) |
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Steven W. <ste...@us...> - 2007-03-29 19:41:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12068/boost-sandbox/libs/units/example Modified Files: unit_example_21.cpp Log Message: mpl_ -> mpl Index: unit_example_21.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_21.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- unit_example_21.cpp 29 Mar 2007 16:43:42 -0000 1.1 +++ unit_example_21.cpp 29 Mar 2007 19:41:23 -0000 1.2 @@ -82,13 +82,13 @@ template<> struct is_implicitly_convertible<unit<volume_type,imperial>, unit<volume_type,us> > : - public mpl_::true_ + public mpl::true_ { }; template<> struct is_implicitly_convertible<unit<volume_type,us>, unit<volume_type,imperial> > : - public mpl_::true_ + public mpl::true_ { }; } // namespace units |
|
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" |
|
From: Matthias S. <mat...@us...> - 2007-03-29 19:38:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10412/detail Removed Files: sys_impl.hpp Log Message: removed sys.hpp and detail/sys_impl.hpp --- sys_impl.hpp DELETED --- |
|
From: Matthias S. <mat...@us...> - 2007-03-29 19:38:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10412 Removed Files: sys.hpp Log Message: removed sys.hpp and detail/sys_impl.hpp --- sys.hpp DELETED --- |
|
From: Steven W. <ste...@us...> - 2007-03-29 19:19:56
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2109/boost-sandbox/boost/units Modified Files: quantity.hpp Log Message: Optimized quantity_cast for UDTs (enabled RVO) Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- quantity.hpp 29 Mar 2007 19:10:39 -0000 1.7 +++ quantity.hpp 29 Mar 2007 19:19:54 -0000 1.8 @@ -375,7 +375,10 @@ { typedef quantity<Unit1,Y> type; - type operator()(quantity<Unit2,X>& source) { return type(source); } + type operator()(quantity<Unit2,X>& source) + { + return conversion_helper<quantity<Unit2,X>,quantity<Unit1,Y> >::convert(source); + } }; /// specialization for casting from one unit system to another @@ -384,7 +387,10 @@ { typedef quantity<Unit1,Y> type; - type operator()(const quantity<Unit2,X>& source) { return type(source); } + type operator()(const quantity<Unit2,X>& source) + { + return conversion_helper<quantity<Unit2,X>,quantity<Unit1,Y> >::convert(source); + } }; /// specialization for casting to the value type |
|
From: Matthias S. <mat...@us...> - 2007-03-29 19:10:41
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29364/systems/si Modified Files: base.hpp Removed Files: angle.hpp solid_angle.hpp Log Message: removed angular units from SI/CGS systems --- solid_angle.hpp DELETED --- --- angle.hpp DELETED --- Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/base.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- base.hpp 29 Mar 2007 00:29:53 -0000 1.2 +++ base.hpp 29 Mar 2007 19:10:40 -0000 1.3 @@ -97,26 +97,26 @@ static std::string symbol() { return "mol"; } }; -template<> -struct base_unit_info<intensity_tag,SI::system_tag> -{ - static std::string name() { return "candela"; } - static std::string symbol() { return "cd"; } -}; - -template<> -struct base_unit_info<angle_tag,SI::system_tag> -{ - static std::string name() { return "radian"; } - static std::string symbol() { return "rd"; } -}; +//template<> +//struct base_unit_info<intensity_tag,SI::system_tag> +//{ +// static std::string name() { return "candela"; } +// static std::string symbol() { return "cd"; } +//}; -template<> -struct base_unit_info<solid_angle_tag,SI::system_tag> -{ - static std::string name() { return "steradian"; } - static std::string symbol() { return "sr"; } -}; +//template<> +//struct base_unit_info<angle_tag,SI::system_tag> +//{ +// static std::string name() { return "radian"; } +// static std::string symbol() { return "rd"; } +//}; +// +//template<> +//struct base_unit_info<solid_angle_tag,SI::system_tag> +//{ +// static std::string name() { return "steradian"; } +// static std::string symbol() { return "sr"; } +//}; } // namespace units |
|
From: Matthias S. <mat...@us...> - 2007-03-29 19:10:41
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29364/systems/conversions Modified Files: conversion_headers.hpp convert_cgs_to_si.hpp convert_si_to_cgs.hpp Removed Files: convert_cgs_to_trig.hpp convert_si_to_trig.hpp convert_trig_to_cgs.hpp convert_trig_to_si.hpp Log Message: removed angular units from SI/CGS systems Index: conversion_headers.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions/conversion_headers.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- conversion_headers.hpp 16 Mar 2007 18:12:45 -0000 1.1.1.1 +++ conversion_headers.hpp 29 Mar 2007 19:10:39 -0000 1.2 @@ -16,12 +16,12 @@ #include <boost/units/systems/conversions/convert_si_to_cgs.hpp> #endif -#if defined(BOOST_UNITS_SI_BASE_HPP) && defined(BOOST_UNITS_TRIG_HPP) - #include <boost/units/systems/conversions/convert_trig_to_si.hpp> - #include <boost/units/systems/conversions/convert_si_to_trig.hpp> -#endif - -#if defined(BOOST_UNITS_TRIG_HPP) && defined(BOOST_UNITS_CGS_BASE_HPP) - #include <boost/units/systems/conversions/convert_cgs_to_trig.hpp> - #include <boost/units/systems/conversions/convert_trig_to_cgs.hpp> -#endif +//#if defined(BOOST_UNITS_SI_BASE_HPP) && defined(BOOST_UNITS_TRIG_HPP) +// #include <boost/units/systems/conversions/convert_trig_to_si.hpp> +// #include <boost/units/systems/conversions/convert_si_to_trig.hpp> +//#endif +// +//#if defined(BOOST_UNITS_TRIG_HPP) && defined(BOOST_UNITS_CGS_BASE_HPP) +// #include <boost/units/systems/conversions/convert_cgs_to_trig.hpp> +// #include <boost/units/systems/conversions/convert_trig_to_cgs.hpp> +//#endif --- convert_cgs_to_trig.hpp DELETED --- --- convert_trig_to_si.hpp DELETED --- Index: convert_cgs_to_si.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions/convert_cgs_to_si.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- convert_cgs_to_si.hpp 16 Mar 2007 18:12:45 -0000 1.1.1.1 +++ convert_cgs_to_si.hpp 29 Mar 2007 19:10:39 -0000 1.2 @@ -47,45 +47,45 @@ public trivial_conversion { }; -template<> -struct base_unit_converter<current_tag,CGS::system_tag,SI::system_tag> -#ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION - : public implicitly_convertible -#endif -{ - typedef double type; - static type value() { return(10); } -}; - -template<> -struct base_unit_converter<temperature_tag,CGS::system_tag,SI::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -template<> -struct base_unit_converter<amount_tag,CGS::system_tag,SI::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -template<> -struct base_unit_converter<intensity_tag,CGS::system_tag,SI::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -template<> -struct base_unit_converter<angle_tag,CGS::system_tag,SI::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -template<> -struct base_unit_converter<solid_angle_tag,CGS::system_tag,SI::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; +//template<> +//struct base_unit_converter<current_tag,CGS::system_tag,SI::system_tag> +//#ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION +// : public implicitly_convertible +//#endif +//{ +// typedef double type; +// static type value() { return(10); } +//}; +// +//template<> +//struct base_unit_converter<temperature_tag,CGS::system_tag,SI::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<amount_tag,CGS::system_tag,SI::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<intensity_tag,CGS::system_tag,SI::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<angle_tag,CGS::system_tag,SI::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<solid_angle_tag,CGS::system_tag,SI::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; } // namespace units --- convert_si_to_trig.hpp DELETED --- --- convert_trig_to_cgs.hpp DELETED --- Index: convert_si_to_cgs.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions/convert_si_to_cgs.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- convert_si_to_cgs.hpp 16 Mar 2007 18:12:45 -0000 1.1.1.1 +++ convert_si_to_cgs.hpp 29 Mar 2007 19:10:39 -0000 1.2 @@ -19,7 +19,8 @@ namespace units { -/// convert meters to centimeters +// conversions from SI to CGS units + template<> struct base_unit_converter<length_tag,SI::system_tag,CGS::system_tag> #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION @@ -30,7 +31,6 @@ static type value() { return(100); } }; -/// convert kilograms to grams template<> struct base_unit_converter<mass_tag,SI::system_tag,CGS::system_tag> #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION @@ -41,58 +41,51 @@ static type value() { return(1000); } }; -/// convert SI seconds to CGS seconds template<> struct base_unit_converter<time_tag,SI::system_tag,CGS::system_tag> : public implicitly_convertible, public trivial_conversion { }; -/// convert amperes to biots -template<> -struct base_unit_converter<current_tag,SI::system_tag,CGS::system_tag> -#ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION - : public implicitly_convertible -#endif -{ - typedef double type; - static type value() { return(0.1); } -}; - -/// convert SI kelvin to CGS kelvin -template<> -struct base_unit_converter<temperature_tag,SI::system_tag,CGS::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -/// convert SI moles to CGS moles -template<> -struct base_unit_converter<amount_tag,SI::system_tag,CGS::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -/// convert SI candelas to CGS candelas -template<> -struct base_unit_converter<intensity_tag,SI::system_tag,CGS::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -/// convert SI radians to CGS radians -template<> -struct base_unit_converter<angle_tag,SI::system_tag,CGS::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; - -/// convert SI steradians to CGS steradians -template<> -struct base_unit_converter<solid_angle_tag,SI::system_tag,CGS::system_tag> : - public implicitly_convertible, - public trivial_conversion -{ }; +//template<> +//struct base_unit_converter<current_tag,SI::system_tag,CGS::system_tag> +//#ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION +// : public implicitly_convertible +//#endif +//{ +// typedef double type; +// static type value() { return(0.1); } +//}; +// +//template<> +//struct base_unit_converter<temperature_tag,SI::system_tag,CGS::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<amount_tag,SI::system_tag,CGS::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<intensity_tag,SI::system_tag,CGS::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<angle_tag,SI::system_tag,CGS::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; +// +//template<> +//struct base_unit_converter<solid_angle_tag,SI::system_tag,CGS::system_tag> : +// public implicitly_convertible, +// public trivial_conversion +//{ }; } // namespace units |
|
From: Matthias S. <mat...@us...> - 2007-03-29 19:10:41
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29364/systems Modified Files: abstract.hpp physical_units.hpp si.hpp trig.hpp Log Message: removed angular units from SI/CGS systems Index: si.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- si.hpp 29 Mar 2007 00:32:57 -0000 1.2 +++ si.hpp 29 Mar 2007 19:10:39 -0000 1.3 @@ -26,9 +26,9 @@ #include <boost/units/systems/si/current.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/si/amount.hpp> -#include <boost/units/systems/si/intensity.hpp> -#include <boost/units/systems/si/angle.hpp> -#include <boost/units/systems/si/solid_angle.hpp> +//#include <boost/units/systems/si/intensity.hpp> +//#include <boost/units/systems/si/angle.hpp> +//#include <boost/units/systems/si/solid_angle.hpp> #include <boost/units/systems/si/acceleration.hpp> #include <boost/units/systems/si/area.hpp> @@ -59,8 +59,8 @@ #include <boost/units/systems/si/resistivity.hpp> #include <boost/units/systems/si/catalytic_activity.hpp> -#include <boost/units/systems/si/illuminance.hpp> -#include <boost/units/systems/si/luminous_flux.hpp> +//#include <boost/units/systems/si/illuminance.hpp> +//#include <boost/units/systems/si/luminous_flux.hpp> #include <boost/units/systems/si/wavenumber.hpp> #endif // BOOST_UNITS_SI_HPP Index: abstract.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/abstract.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- abstract.hpp 29 Mar 2007 00:29:34 -0000 1.2 +++ abstract.hpp 29 Mar 2007 19:10:39 -0000 1.3 @@ -54,7 +54,7 @@ typedef unit<current_type,system> current; ///< abstract unit of current typedef unit<temperature_type,system> temperature; ///< abstract unit of temperature typedef unit<amount_type,system> amount; ///< abstract unit of amount -typedef unit<intensity_type,system> intensity; ///< abstract unit of intensity +//typedef unit<intensity_type,system> intensity; ///< abstract unit of intensity typedef unit<angle_type,system> angle; ///< abstract unit of angle typedef unit<solid_angle_type,system> solid_angle; ///< abstract unit of solid angle Index: trig.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/trig.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- trig.hpp 29 Mar 2007 00:31:48 -0000 1.2 +++ trig.hpp 29 Mar 2007 19:10:39 -0000 1.3 @@ -56,6 +56,10 @@ typedef homogeneous_system<gradian_system_tag> gradian_system; ///< gradian unit system typedef homogeneous_system<radian_system_tag> radian_system; ///< radian unit system +typedef unit<dimensionless_type,degree_system> dimensionless_degree; +typedef unit<dimensionless_type,gradian_system> dimensionless_gradian; +typedef unit<dimensionless_type,radian_system> dimensionless_radian; + typedef unit<angle_type,degree_system> degree; ///< degree unit constant typedef unit<angle_type,gradian_system> gradian; ///< gradian unit constant typedef unit<angle_type,radian_system> radian; ///< radian unit constant Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- physical_units.hpp 29 Mar 2007 00:30:39 -0000 1.2 +++ physical_units.hpp 29 Mar 2007 19:10:39 -0000 1.3 @@ -17,7 +17,7 @@ /// \file /// \brief Various definitions to simplify systems of physical units. /// -/// \detailed This file includes the seven SI-defined fundamental dimensions as +/// \detailed This file includes the six SI-defined fundamental dimensions as /// well as composite dimensions for a number of commonly encountered /// physical unit types. Angles and solid angles are technically dimensionless. /// However, incorrect use of degrees and radians is a common source of errors, @@ -28,22 +28,22 @@ namespace units { /// tag representing length -struct length_tag : public ordinal<-9> { }; +struct length_tag : public ordinal<-8> { }; /// tag representing mass -struct mass_tag : public ordinal<-8> { }; +struct mass_tag : public ordinal<-7> { }; /// tag representing time -struct time_tag : public ordinal<-7> { }; +struct time_tag : public ordinal<-6> { }; /// tag representing electrical current -struct current_tag : public ordinal<-6> { }; +struct current_tag : public ordinal<-5> { }; /// tag representing temperature -struct temperature_tag : public ordinal<-5> { }; +struct temperature_tag : public ordinal<-4> { }; /// tag representing amount of substance -struct amount_tag : public ordinal<-4> { }; +struct amount_tag : public ordinal<-3> { }; /// tag representing luminous intensity - demoted from status as a fundamental SI unit in 1979 struct intensity_tag : public ordinal<-3> { }; |
|
From: Matthias S. <mat...@us...> - 2007-03-29 19:10:40
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29364 Modified Files: quantity.hpp Log Message: removed angular units from SI/CGS systems Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- quantity.hpp 29 Mar 2007 18:51:36 -0000 1.6 +++ quantity.hpp 29 Mar 2007 19:10:39 -0000 1.7 @@ -54,7 +54,7 @@ this_type& operator=(const this_type& source) { - + val_ = source.val_; return *this; @@ -171,7 +171,6 @@ this_type& operator=(const this_type& source) { - val_ = source.val_; return *this; |
|
From: Steven W. <ste...@us...> - 2007-03-29 19:02:30
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25498/boost-sandbox/boost/units Modified Files: cmath.hpp Log Message: Replaced quantity_reinterpret_cast with quantity_cast Index: cmath.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/cmath.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cmath.hpp 29 Mar 2007 00:32:41 -0000 1.2 +++ cmath.hpp 29 Mar 2007 19:02:29 -0000 1.3 @@ -409,7 +409,7 @@ typedef quantity<Unit,Y> quantity_type; - return quantity_type::from_value(modf(q1.value(), quantity_reinterpret_cast<Y*>(q2))); + return quantity_type::from_value(modf(q1.value(), &quantity_cast<Y&>(*q2))); } template<class Unit, class Y, class Int> |
|
From: Steven W. <ste...@us...> - 2007-03-29 19:00:27
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24586/boost-sandbox/boost/units Modified Files: io.hpp Log Message: Replaced quantity_reinterpret_cast with quantity_cast Index: io.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/io.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- io.hpp 29 Mar 2007 16:53:39 -0000 1.3 +++ io.hpp 29 Mar 2007 19:00:26 -0000 1.4 @@ -36,7 +36,7 @@ template<class Archive,class Unit,class Y> inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsigned int version) { - ar & units::quantity_reinterpret_cast<Y&>(q); + ar & units::quantity_cast<Y&>(q); } } // namespace serialization |
|
From: Steven W. <ste...@us...> - 2007-03-29 18:51:37
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20927/boost-sandbox/boost/units Modified Files: quantity.hpp Log Message: Made quantity_cast able to cast to the value_type Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- quantity.hpp 29 Mar 2007 18:24:44 -0000 1.5 +++ quantity.hpp 29 Mar 2007 18:51:36 -0000 1.6 @@ -349,12 +349,21 @@ { typedef quantity<Unit,X> type; - type operator()(const Y& source) { return type::from_value(source); } + type operator()(Y& source) { return type::from_value(source); } }; /// specialization for casting from one value_type to another template<class Unit,class X,class Y> -struct quantity_cast_helper< X,quantity<Unit,Y> > +struct quantity_cast_helper< quantity<Unit,X>,quantity<Unit,Y> > +{ + typedef quantity<Unit,X> type; + + type operator()(quantity<Unit,Y>& source) { return type::from_value(source.value()); } +}; + +/// specialization for casting from one value_type to another +template<class Unit,class X,class Y> +struct quantity_cast_helper< quantity<Unit,X>,const quantity<Unit,Y> > { typedef quantity<Unit,X> type; @@ -362,31 +371,67 @@ }; /// specialization for casting from one unit system to another -template<class X,class System,class Dim,class Unit2> -struct quantity_cast_helper< unit<Dim,System>,quantity<Unit2,X> > +template<class Y,class X,class Unit1,class Unit2> +struct quantity_cast_helper< quantity<Unit1,Y>,quantity<Unit2,X> > { - typedef quantity<unit<Dim,System>,X> type; + typedef quantity<Unit1,Y> type; + + type operator()(quantity<Unit2,X>& source) { return type(source); } +}; + +/// specialization for casting from one unit system to another +template<class Y,class X,class Unit1,class Unit2> +struct quantity_cast_helper< quantity<Unit1,Y>,const quantity<Unit2,X> > +{ + typedef quantity<Unit1,Y> type; type operator()(const quantity<Unit2,X>& source) { return type(source); } }; +/// specialization for casting to the value type +template<class Y,class X,class Unit2> +struct quantity_cast_helper<Y,quantity<Unit2,X> > +{ + typedef Y type; + + type operator()(quantity<Unit2,X>& source) { return const_cast<X&>(source.value()); } +}; + +/// specialization for casting to the value type +template<class Y,class X,class Unit2> +struct quantity_cast_helper<Y,const quantity<Unit2,X> > +{ + typedef Y type; + + type operator()(const quantity<Unit2,X>& source) { return source.value(); } +}; + /// quantity_cast supporting three types of casting: /// /// 1) Casting from a @c value_type to a @c quantity : /// @verbatim quantity<Unit,X> q = quantity_cast< quantity<Unit,X> >(const X&); @endverbatim /// 2) Casting from one @c value_type to another @c value_type : -/// @verbatim quantity<Unit,X> q = quantity_cast<X>(const quantity<Unit,Y>&); @endverbatim +/// @verbatim quantity<Unit,X> q = quantity_cast<quantity<Unit,X> >(const quantity<Unit,Y>&); @endverbatim /// 3) Casting from one unit system to another : -/// @verbatim quantity<unit,X> q = quantity_cast< unit<Dim,System1> >(const quantity<unit<Dim,System2> >,X>&); @endverbatim +/// @verbatim quantity<unit,X> q = quantity_cast< quantity<unit<Dim,System1>,X> >(const quantity<unit<Dim,System2> >,Y>&); @endverbatim template<class X,class Y> inline typename quantity_cast_helper<X,Y>::type -quantity_cast(const Y& source) +quantity_cast(Y& source) { quantity_cast_helper<X,Y> qch; return qch(source); } +template<class X,class Y> +inline +typename quantity_cast_helper<X,const Y>::type +quantity_cast(const Y& source) +{ + quantity_cast_helper<X,const Y> qch; + + return qch(source); +} /// specialize unary plus typeof helper template<class Unit,class Y> |
|
From: Steven W. <ste...@us...> - 2007-03-29 18:25:02
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10096/boost-sandbox/boost/units Modified Files: quantity.hpp Log Message: Made constructor explicit when BOOST_NO_SFINAE is defined Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- quantity.hpp 29 Mar 2007 18:18:14 -0000 1.4 +++ quantity.hpp 29 Mar 2007 18:24:44 -0000 1.5 @@ -102,13 +102,13 @@ #else - /// without SFINAE we can't distinguish between explicit and implicit conversions + /// without SFINAE we can't distinguish between explicit and implicit conversions so + /// the conversion is always explicit template<class System2,class Dim2,class YY> - quantity(const quantity<unit<Dim2,System2>,YY>& source) + explicit quantity(const quantity<unit<Dim2,System2>,YY>& source) : val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value()) { BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true)); - BOOST_STATIC_ASSERT((is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::value == true)); } #endif |
|
From: Steven W. <ste...@us...> - 2007-03-29 18:18:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6983/boost-sandbox/boost/units Modified Files: quantity.hpp Log Message: Removed increment and decrement operators Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- quantity.hpp 29 Mar 2007 16:51:51 -0000 1.3 +++ quantity.hpp 29 Mar 2007 18:18:14 -0000 1.4 @@ -136,11 +136,6 @@ // need to check that subtract_typeof_helper<value_type,value_type>==value_type this_type& operator-=(const this_type& source) { val_ -= source.val_; return *this; } ///< can subtract quantity of same type - this_type& operator++() { ++val_; return *this; } - this_type& operator++(int) { this_type temp(*this); ++*this; return temp; } - this_type operator--() { --val_; return *this; } - this_type operator--(int) { this_type temp(*this); --*this; return temp; } - this_type& operator*=(const value_type& val) { val_ *= val; return *this; } ///< can multiply quantity by scalar this_type& operator/=(const value_type& val) { val_ /= val; return *this; } ///< can divide quantity by scalar @@ -226,11 +221,6 @@ this_type& operator+=(const this_type& source) { val_ += source.val_; return *this; } ///< can add quantity of same type this_type& operator-=(const this_type& source) { val_ -= source.val_; return *this; } ///< can subtract quantity of same type // consider adding *=,/= for dimensionless_type - - this_type& operator++() { ++val_; return *this; } - this_type& operator++(int) { this_type temp(*this); ++*this; return temp; } - this_type operator--() { --val_; return *this; } - this_type operator--(int) { this_type temp(*this); --*this; return temp; } // can multiply or divide by value_type this_type& operator*=(const value_type& val) { val_ *= val; return *this; } ///< can multiply quantity by scalar @@ -264,13 +254,13 @@ template<class X, class Unit,class Y> X quantity_reinterpret_cast(const quantity<Unit,Y>& q) { - return reinterpret_cast<X>(const_cast<Y&>(q.value())); + return q.value(); } template<class X, class Unit,class Y> X quantity_reinterpret_cast(quantity<Unit,Y>& q) { - return reinterpret_cast<X>(const_cast<Y&>(q.value())); + return const_cast<Y&>(q.value()); } /// swap quantities |
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/cgs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18870 Removed Files: amount.hpp angle.hpp current.hpp intensity.hpp solid_angle.hpp temperature.hpp Log Message: remove non-CGS units from CGS system --- solid_angle.hpp DELETED --- --- amount.hpp DELETED --- --- temperature.hpp DELETED --- --- angle.hpp DELETED --- --- intensity.hpp DELETED --- --- current.hpp DELETED --- |
|
From: Matthias S. <mat...@us...> - 2007-03-29 17:22:39
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/cgs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17297 Removed Files: catalytic_activity.hpp Log Message: remove cgs/catalytic_activity.hpp --- catalytic_activity.hpp DELETED --- |
|
From: Matthias S. <mat...@us...> - 2007-03-29 17:21:05
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16523/boost/units/systems Modified Files: cgs.hpp Log Message: remove non-CGS base units from CGS system Index: cgs.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/cgs.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cgs.hpp 29 Mar 2007 00:33:16 -0000 1.2 +++ cgs.hpp 29 Mar 2007 17:21:04 -0000 1.3 @@ -23,16 +23,16 @@ #include <boost/units/systems/cgs/length.hpp> #include <boost/units/systems/cgs/mass.hpp> #include <boost/units/systems/cgs/time.hpp> -#include <boost/units/systems/cgs/current.hpp> -#include <boost/units/systems/cgs/temperature.hpp> -#include <boost/units/systems/cgs/amount.hpp> -#include <boost/units/systems/cgs/intensity.hpp> -#include <boost/units/systems/cgs/angle.hpp> -#include <boost/units/systems/cgs/solid_angle.hpp> +//#include <boost/units/systems/cgs/current.hpp> +//#include <boost/units/systems/cgs/temperature.hpp> +//#include <boost/units/systems/cgs/amount.hpp> +//#include <boost/units/systems/cgs/intensity.hpp> +//#include <boost/units/systems/cgs/angle.hpp> +//#include <boost/units/systems/cgs/solid_angle.hpp> #include <boost/units/systems/cgs/acceleration.hpp> #include <boost/units/systems/cgs/area.hpp> -#include <boost/units/systems/cgs/catalytic_activity.hpp> +//#include <boost/units/systems/cgs/catalytic_activity.hpp> #include <boost/units/systems/cgs/energy.hpp> #include <boost/units/systems/cgs/force.hpp> #include <boost/units/systems/cgs/frequency.hpp> |
|
From: Matthias S. <mat...@us...> - 2007-03-29 17:21:05
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/cgs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16523/boost/units/systems/cgs Modified Files: base.hpp Log Message: remove non-CGS base units from CGS system Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/cgs/base.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- base.hpp 29 Mar 2007 00:30:17 -0000 1.2 +++ base.hpp 29 Mar 2007 17:21:04 -0000 1.3 @@ -76,47 +76,47 @@ static std::string symbol() { return "s"; } }; -template<> -struct base_unit_info<current_tag,CGS::system_tag> -{ - static std::string name() { return "biot"; } - static std::string symbol() { return "Bi"; } -}; - -template<> -struct base_unit_info<temperature_tag,CGS::system_tag> -{ - static std::string name() { return "kelvin"; } - static std::string symbol() { return "K"; } -}; - -template<> -struct base_unit_info<amount_tag,CGS::system_tag> -{ - static std::string name() { return "mole"; } - static std::string symbol() { return "mol"; } -}; - -template<> -struct base_unit_info<intensity_tag,CGS::system_tag> -{ - static std::string name() { return "candela"; } - static std::string symbol() { return "cd"; } -}; - -template<> -struct base_unit_info<angle_tag,CGS::system_tag> -{ - static std::string name() { return "radian"; } - static std::string symbol() { return "rd"; } -}; - -template<> -struct base_unit_info<solid_angle_tag,CGS::system_tag> -{ - static std::string name() { return "steradian"; } - static std::string symbol() { return "sr"; } -}; +//template<> +//struct base_unit_info<current_tag,CGS::system_tag> +//{ +// static std::string name() { return "biot"; } +// static std::string symbol() { return "Bi"; } +//}; +// +//template<> +//struct base_unit_info<temperature_tag,CGS::system_tag> +//{ +// static std::string name() { return "kelvin"; } +// static std::string symbol() { return "K"; } +//}; +// +//template<> +//struct base_unit_info<amount_tag,CGS::system_tag> +//{ +// static std::string name() { return "mole"; } +// static std::string symbol() { return "mol"; } +//}; +// +//template<> +//struct base_unit_info<intensity_tag,CGS::system_tag> +//{ +// static std::string name() { return "candela"; } +// static std::string symbol() { return "cd"; } +//}; +// +//template<> +//struct base_unit_info<angle_tag,CGS::system_tag> +//{ +// static std::string name() { return "radian"; } +// static std::string symbol() { return "rd"; } +//}; +// +//template<> +//struct base_unit_info<solid_angle_tag,CGS::system_tag> +//{ +// static std::string name() { return "steradian"; } +// static std::string symbol() { return "sr"; } +//}; } // namespace units |
|
From: Matthias S. <mat...@us...> - 2007-03-29 17:10:55
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12561/example Modified Files: test_system.hpp unit_example_20.cpp Log Message: unit_info -> base_unit_info Index: unit_example_20.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_20.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_20.cpp 16 Mar 2007 18:29:53 -0000 1.1.1.1 +++ unit_example_20.cpp 29 Mar 2007 17:10:55 -0000 1.2 @@ -148,7 +148,7 @@ } // fahrenheit -template<> struct unit_info<fahrenheit::system_tag,temperature_tag> +template<> struct base_unit_info<temperature_tag,fahrenheit::system_tag> { static std::string name() { return "Fahrenheit"; } static std::string symbol() { return "F"; } Index: test_system.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/test_system.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- test_system.hpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ test_system.hpp 29 Mar 2007 17:10:55 -0000 1.2 @@ -95,20 +95,20 @@ } // namespace test //[test_system_snippet_8 -template<> struct unit_info<test::system_tag,length_tag> +template<> struct base_unit_info<length_tag,test::system_tag> { static std::string name() { return "meter"; } static std::string symbol() { return "m"; } }; //] -template<> struct unit_info<test::system_tag,mass_tag> +template<> struct base_unit_info<mass_tag,test::system_tag> { static std::string name() { return "kilogram"; } static std::string symbol() { return "kg"; } }; -template<> struct unit_info<test::system_tag,time_tag> +template<> struct base_unit_info<time_tag,test::system_tag> { static std::string name() { return "second"; } static std::string symbol() { return "s"; } |
|
From: Matthias S. <mat...@us...> - 2007-03-29 17:10:55
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12561/test Modified Files: test_header.hpp Log Message: unit_info -> base_unit_info Index: test_header.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_header.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- test_header.hpp 16 Mar 2007 18:29:55 -0000 1.1.1.1 +++ test_header.hpp 29 Mar 2007 17:10:55 -0000 1.2 @@ -89,19 +89,20 @@ BOOST_UNITS_STATIC_CONSTANT(cubic_meter,volume); BOOST_UNITS_STATIC_CONSTANT(cubic_meters,volume); -template<> struct unit_info<system_tag,length_tag> +template<> struct base_unit_info<length_tag,system_tag> { static std::string name() { return "meter"; } static std::string symbol() { return "m"; } }; +//] -template<> struct unit_info<system_tag,mass_tag> +template<> struct base_unit_info<mass_tag,system_tag> { static std::string name() { return "kilogram"; } static std::string symbol() { return "kg"; } }; -template<> struct unit_info<system_tag,time_tag> +template<> struct base_unit_info<time_tag,system_tag> { static std::string name() { return "second"; } static std::string symbol() { return "s"; } |
|
From: Matthias S. <mat...@us...> - 2007-03-29 16:55:53
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6421/detail Modified Files: conversion_impl.hpp Log Message: renamed define_reverse_automatically -> trivial_inverse_conversion Index: conversion_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/conversion_impl.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- conversion_impl.hpp 29 Mar 2007 00:31:27 -0000 1.2 +++ conversion_impl.hpp 29 Mar 2007 16:55:50 -0000 1.3 @@ -94,32 +94,36 @@ struct identity_conversion : trivial_conversion, implicitly_convertible {}; -struct define_reverse_automatically {}; +struct trivial_inverse_conversion { }; -struct undefined_conversion {}; +struct undefined_conversion { }; template<class Converter> -struct reverse_conversion - : mpl::if_<is_base_and_derived<implicitly_convertible, Converter>, implicitly_convertible, undefined_conversion>::type { +struct reverse_conversion : + public mpl::if_<is_base_and_derived<implicitly_convertible, Converter>, implicitly_convertible, undefined_conversion>::type +{ typedef typename Converter::type type; - static type value() { + + static type value() + { return(one()/Converter::value()); } }; template<class Dimension, class Tag1, class Tag2> struct base_unit_converter : - mpl::eval_if<is_same<Tag1, Tag2>, + public mpl::eval_if<is_same<Tag1, Tag2>, mpl::identity<identity_conversion>, mpl::if_< is_base_and_derived< - define_reverse_automatically, + trivial_inverse_conversion, base_unit_converter<Dimension,Tag2,Tag1> >, reverse_conversion<base_unit_converter<Dimension,Tag2,Tag1> >, undefined_conversion > - >::type {}; + >::type +{ }; template<class Tag,class System1,class System2> struct base_unit_is_implicitly_convertible : |
|
From: Matthias S. <mat...@us...> - 2007-03-29 16:53:40
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5625 Modified Files: io.hpp Log Message: fixed quantity_reinterpret_cast - needs units:: namespace qualification Index: io.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/io.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- io.hpp 29 Mar 2007 00:32:22 -0000 1.2 +++ io.hpp 29 Mar 2007 16:53:39 -0000 1.3 @@ -36,7 +36,7 @@ template<class Archive,class Unit,class Y> inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsigned int version) { - ar & quantity_reinterpret_cast<Y&>(q); + ar & units::quantity_reinterpret_cast<Y&>(q); } } // namespace serialization |
|
From: Matthias S. <mat...@us...> - 2007-03-29 16:51:51
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4845 Modified Files: quantity.hpp Log Message: changed quantity_reinterpret_cast to remove need to be friend of quantity Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- quantity.hpp 29 Mar 2007 00:29:12 -0000 1.2 +++ quantity.hpp 29 Mar 2007 16:51:51 -0000 1.3 @@ -26,13 +26,7 @@ template<class Q1,class Q2> class conversion_helper; template<class Unit,class Y = double> class quantity; - -template<class T, class Quantity> -T quantity_reinterpret_cast(const Quantity& q); - -template<class T, class Quantity> -T quantity_reinterpret_cast(Quantity& q); - + /// class declaration //template<class System,class Dim,class Y> //class quantity<unit<Dim,System>,Y> @@ -42,9 +36,6 @@ template<class Unit,class Y> class quantity { - friend const Y& quantity_reinterpret_cast(const quantity& q); - friend Y& quantity_reinterpret_cast<>(quantity& q); - friend const Y& quantity_reinterpret_cast<>(quantity& q); public: typedef quantity<Unit,Y> this_type; typedef typename get_dimension<Unit>::type Dim; @@ -170,9 +161,6 @@ template<class System,class Y> class quantity<unit<dimensionless_type,System>,Y> { - friend const Y& quantity_reinterpret_cast(const quantity& q); - friend Y& quantity_reinterpret_cast<>(quantity& q); - friend const Y& quantity_reinterpret_cast<>(quantity& q); public: typedef quantity<unit<dimensionless_type,System>,Y> this_type; @@ -273,17 +261,16 @@ namespace units { /// extract a reference to the value type -template<class T, class Quantity> -T quantity_reinterpret_cast(const Quantity& q) +template<class X, class Unit,class Y> +X quantity_reinterpret_cast(const quantity<Unit,Y>& q) { - return(q.val_); + return reinterpret_cast<X>(const_cast<Y&>(q.value())); } -/// extract a (mutable) reference to the value type -template<class T, class Quantity> -T quantity_reinterpret_cast(Quantity& q) +template<class X, class Unit,class Y> +X quantity_reinterpret_cast(quantity<Unit,Y>& q) { - return(q.val_); + return reinterpret_cast<X>(const_cast<Y&>(q.value())); } /// swap quantities |
|
From: Matthias S. <mat...@us...> - 2007-03-29 16:48:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2954 Modified Files: unit_example_16.cpp Log Message: demonstrates use of trivial_inverse_conversion Index: unit_example_16.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_16.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_16.cpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ unit_example_16.cpp 29 Mar 2007 16:48:14 -0000 1.2 @@ -64,26 +64,20 @@ // IO helper class template<> -struct unit_info<nautical::system_tag,length_tag> +struct base_unit_info<length_tag,nautical::system_tag> { static std::string name() { return "nautical mile"; } static std::string symbol() { return "nmi"; } }; -// helpers for conversions between nautical length and SI length +// helper for conversions between nautical length and SI length template<> -struct base_unit_converter<length_tag,nautical::system_tag,SI::system_tag> +struct base_unit_converter<length_tag,nautical::system_tag,SI::system_tag> : + public trivial_inverse_conversion { typedef double type; static type value() { return 1.852e3; } }; - -template<> -struct base_unit_converter<length_tag,SI::system_tag,nautical::system_tag> -{ - typedef double type; - static type value() { return 1.0/1.852e3; } -}; //] //[unit_example_16_class_snippet_2 @@ -103,7 +97,7 @@ // IO helper class template<> -struct unit_info<imperial::system_tag,length_tag> +struct base_unit_info<length_tag,imperial::system_tag> { static std::string name() { return "foot"; } static std::string symbol() { return "ft"; } |
|
From: Matthias S. <mat...@us...> - 2007-03-29 16:45:03
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1588 Added Files: unit_example_22.cpp Log Message: miscellaneous examples demonstrating questions arising during Boost review --- NEW FILE: unit_example_22.cpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** \file \brief unit_example_22.cpp \detailed Another example of defining units. Output: @verbatim //[unit_example_22_output kg s^(-3) K^(-1) kg s^(-3) K^(-1) 1 kg s^(-3) K^(-1) //] @endverbatim **/ /* #include <iostream> #include <boost/units/io.hpp> #include <boost/units/unit.hpp> #include <boost/units/quantity.hpp> #include <boost/units/systems/si.hpp> using namespace boost::units; using namespace boost::units::SI; typedef quantity<power> power_t; typedef quantity<area> area_t; typedef quantity<temperature> temp_diff_t; typedef typeof(watts/kelvin/pow<2>(meter)) heat_transfer_coefficient_unit_type; typedef quantity<heat_transfer_coefficient_unit_type> heat_transfer_coefficient_t; int main() { const heat_transfer_coefficient_t watts_per_square_meter_per_kelvin = 1.0*watts/square_meter/kelvin; std::cout << watts/kelvin/pow<2>(meter) << std::endl; std::cout << heat_transfer_coefficient_unit_type() << std::endl << watts_per_square_meter_per_kelvin << std::endl << std::endl; return 0; } */ /* #include <iostream> #include <boost/numeric/ublas/vector.hpp> //#include <boost/test/test_tools.hpp> //#include <boost/test/floating_point_comparison.hpp> #include <boost/units/io.hpp> #include <boost/units/unit.hpp> #include <boost/units/quantity.hpp> #include <boost/units/systems/si.hpp> using namespace boost::units; using namespace boost::units::SI; int main() { // quantity<SI::length> a,b; // // BOOST_CHECK_CLOSE(a.value(),b.value(),0.1); //typedef double Type; typedef quantity<SI::length> Type; boost::numeric::ublas::vector<Type> v(3); v *= 2.0; //v*2.0; return 0; } */ /* #include <iostream> #include <boost/any.hpp> #include <boost/numeric/ublas/vector.hpp> #include <boost/units/io.hpp> #include <boost/units/unit.hpp> #include <boost/units/quantity.hpp> #include <boost/units/systems/si.hpp> using namespace boost::units; using namespace boost::units::SI; int main() { boost::numeric::ublas::vector<boost::any> v(3); v(0) = boost::any(quantity<SI::length>(3.0*meters)); v(1) = boost::any(quantity<SI::mass>(3.0*kilograms)); v(2) = boost::any(quantity<SI::time>(3.0*seconds)); std::cout << boost::any_cast< quantity<SI::length> >(v(0)) << std::endl; std::cout << boost::any_cast< quantity<SI::mass> >(v(1)) << std::endl; std::cout << boost::any_cast< quantity<SI::time> >(v(2)) << std::endl; std::cout << boost::any_cast< quantity<SI::mass> >(v(0)) << std::endl; return 0; } */ #include <iostream> #include <boost/units/io.hpp> #include <boost/units/systems/si.hpp> #include <boost/units/systems/cgs.hpp> #include <boost/units/systems/si/prefixes.hpp> using namespace boost::units; int main() { 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> F3(F0); // quantity<SI::force> F4 = F0; quantity<SI::force> F5(20 * CGS::dyne); // quantity<SI::force> F6 = 20 * CGS::dyne; std::cout << F1 << std::endl << F2 << std::endl << F3 << std::endl << F5 << std::endl << std::endl; quantity_reinterpret_cast<double&>(F1) = 1.5; std::cout << F1 << std::endl; return 0; } |