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: Matthias S. <mat...@us...> - 2007-04-10 22:57:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10814 Modified Files: quantity.hpp Log Message: streamline runtime comparison operators Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- quantity.hpp 9 Apr 2007 16:50:41 -0000 1.15 +++ quantity.hpp 10 Apr 2007 22:57:24 -0000 1.16 @@ -851,107 +851,179 @@ } /// runtime operator== -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator==(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator==(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() == val2.value(); } /// runtime operator!= -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator!=(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator!=(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() != val2.value(); } /// runtime operator< -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator<(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator<(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() < val2.value(); } /// runtime operator<= -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator<=(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator<=(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() <= val2.value(); } /// runtime operator> -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator>(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator>(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() > val2.value(); } /// runtime operator>= -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator>=(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator>=(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() >= val2.value(); } +///// runtime operator== +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator==(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() == val2.value(); +//} +// +///// runtime operator!= +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator!=(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() != val2.value(); +//} +// +///// runtime operator< +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator<(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() < val2.value(); +//} +// +///// runtime operator<= +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator<=(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() <= val2.value(); +//} +// +///// runtime operator> +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator>(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() > val2.value(); +//} +// +///// runtime operator>= +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator>=(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() >= val2.value(); +//} + } // namespace units } // namespace boost |
|
From: Matthias S. <mat...@us...> - 2007-04-10 16:55:08
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/other In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26210/systems/other Modified Files: non_si_units.hpp Log Message: corrected definitions/syntax Index: non_si_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/other/non_si_units.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- non_si_units.hpp 2 Apr 2007 20:12:51 -0000 1.2 +++ non_si_units.hpp 10 Apr 2007 16:53:52 -0000 1.3 @@ -13,7 +13,14 @@ // SI conversion factors for various non-SI units -#include <boost/units/systems/si.hpp> +#include <boost/units/systems/si/area.hpp> +#include <boost/units/systems/si/length.hpp> +#include <boost/units/systems/si/mass.hpp> +#include <boost/units/systems/si/plane_angle.hpp> +#include <boost/units/systems/si/pressure.hpp> +#include <boost/units/systems/si/time.hpp> +#include <boost/units/systems/si/velocity.hpp> +#include <boost/units/systems/si/volume.hpp> namespace boost { @@ -27,13 +34,13 @@ namespace astronomical { // units of length -BOOST_UNITS_STATIC_CONSTANT(astronomical_unit,length) = 149597870691.0*meters; -BOOST_UNITS_STATIC_CONSTANT(light_day,length) = 2.59020683712e13*meters; -BOOST_UNITS_STATIC_CONSTANT(light_hour,length) = 1.0792528488e12*meters; -BOOST_UNITS_STATIC_CONSTANT(light_minute,length) = 1.798754748e10*meters; -BOOST_UNITS_STATIC_CONSTANT(light_second,length) = 2.99792458e8*meters; -BOOST_UNITS_STATIC_CONSTANT(light_year,length) = 9.460730472580e15*meters; -BOOST_UNITS_STATIC_CONSTANT(parsec,length) = 3.0856775813e16*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(astronomical_unit,149597870691.0*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(light_day,2.59020683712e13*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(light_hour,1.0792528488e12*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(light_minute,1.798754748e10*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(light_second,2.99792458e8*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(light_year,9.460730472580e15*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(parsec,3.0856775813e16*meters); } // namespace astronomical @@ -46,54 +53,59 @@ namespace metric { // units of length -BOOST_UNITS_STATIC_CONSTANT(angstrom,length) = 1.0e-10*meters; -BOOST_UNITS_STATIC_CONSTANT(angstroms,length) = 1.0e-10*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(angstrom,1.0e-10*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(angstroms,1.0e-10*meters); -BOOST_UNITS_STATIC_CONSTANT(fermi,length) = 1.0e-15*meters; -BOOST_UNITS_STATIC_CONSTANT(fermis,length) = 1.0e-15*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(fermi,1.0e-15*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(fermis,1.0e-15*meters); -BOOST_UNITS_STATIC_CONSTANT(micron,length) = 1.0e-6*meters; -BOOST_UNITS_STATIC_CONSTANT(microns,length) = 1.0e-6*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(micron,1.0e-6*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(microns,1.0e-6*meters); // units of mass -BOOST_UNITS_STATIC_CONSTANT(ton,mass) = 1.0e3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(tons,mass) = 1.0e3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(tonne,mass) = 1.0e3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(tonnes,mass) = 1.0e3*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(ton,1.0e3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(tons,1.0e3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(tonne,1.0e3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(tonnes,1.0e3*kilograms); // units of time -BOOST_UNITS_STATIC_CONSTANT(day,time) = 86400.0*seconds; -BOOST_UNITS_STATIC_CONSTANT(days,time) = 86400.0*seconds; +BOOST_UNITS_AUTO_STATIC_CONSTANT(day,86400.0*seconds); +BOOST_UNITS_AUTO_STATIC_CONSTANT(days,86400.0*seconds); -BOOST_UNITS_STATIC_CONSTANT(hour,time) = 3600.0*seconds; -BOOST_UNITS_STATIC_CONSTANT(hours,time) = 3600.0*seconds; +BOOST_UNITS_AUTO_STATIC_CONSTANT(hour,3600.0*seconds); +BOOST_UNITS_AUTO_STATIC_CONSTANT(hours,3600.0*seconds); -BOOST_UNITS_STATIC_CONSTANT(minute,time) = 60.0*seconds; -BOOST_UNITS_STATIC_CONSTANT(minutes,time) = 60.0*seconds; +BOOST_UNITS_AUTO_STATIC_CONSTANT(minute,60.0*seconds); +BOOST_UNITS_AUTO_STATIC_CONSTANT(minutes,60.0*seconds); // units of planar angle -//BOOST_UNITS_STATIC_CONSTANT(arc_degree,angle) = (pi/180)*radians; -//BOOST_UNITS_STATIC_CONSTANT(arc_minute,angle) = (pi/10800)*radians; -//BOOST_UNITS_STATIC_CONSTANT(arc_second,angle) = (pi/648000)*radians; +BOOST_UNITS_AUTO_STATIC_CONSTANT(arcdegree,(3.14159265358979323846264338328/180)*radians); +BOOST_UNITS_AUTO_STATIC_CONSTANT(arcdegrees,(3.14159265358979323846264338328/180)*radians); + +BOOST_UNITS_AUTO_STATIC_CONSTANT(arcminute,(3.14159265358979323846264338328/10800)*radians); +BOOST_UNITS_AUTO_STATIC_CONSTANT(arcminutes,(3.14159265358979323846264338328/10800)*radians); + +BOOST_UNITS_AUTO_STATIC_CONSTANT(arcsecond,(3.14159265358979323846264338328/648000)*radians); +BOOST_UNITS_AUTO_STATIC_CONSTANT(arcseconds,(3.14159265358979323846264338328/648000)*radians); // units of area -BOOST_UNITS_STATIC_CONSTANT(are,area) = 1.0e2*square_meters; -BOOST_UNITS_STATIC_CONSTANT(are,area) = 1.0e2*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(are,1.0e2*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(ares,1.0e2*square_meters); -BOOST_UNITS_STATIC_CONSTANT(barn,area) = 1.0e-28*square_meters; -BOOST_UNITS_STATIC_CONSTANT(barns,area) = 1.0e-28*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(barn,1.0e-28*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(barns,1.0e-28*square_meters); -BOOST_UNITS_STATIC_CONSTANT(hectare,area) = 1.0e4*square_meters; -BOOST_UNITS_STATIC_CONSTANT(hectares,area) = 1.0e4*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(hectare,1.0e4*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(hectares,1.0e4*square_meters); // units of volume -BOOST_UNITS_STATIC_CONSTANT(liter,volume) = 1.0e-3*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(liters,volume) = 1.0e-3*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(litre,volume) = 1.0e-3*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(litres,volume) = 1.0e-3*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(liter,1.0e-3*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(liters,1.0e-3*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(litre,1.0e-3*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(litres,1.0e-3*cubic_meters); // units of pressure -BOOST_UNITS_STATIC_CONSTANT(bar,pressure) = 1.0e5*pascals; +BOOST_UNITS_AUTO_STATIC_CONSTANT(bar,1.0e5*pascals); } // namespace metric @@ -101,17 +113,17 @@ namespace nautical { // units of length -BOOST_UNITS_STATIC_CONSTANT(fathom,length) = 1.852*meters; -BOOST_UNITS_STATIC_CONSTANT(fathoms,length) = 1.852*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(fathom,1.852*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(fathoms,1.852*meters); -BOOST_UNITS_STATIC_CONSTANT(knot,velocity) = (1852.0/3600.0)*meters_per_second; -BOOST_UNITS_STATIC_CONSTANT(knots,velocity) = (1852.0/3600.0)*meters_per_second; +BOOST_UNITS_AUTO_STATIC_CONSTANT(knot,(1852.0/3600.0)*meters_per_second); +BOOST_UNITS_AUTO_STATIC_CONSTANT(knots,(1852.0/3600.0)*meters_per_second); -BOOST_UNITS_STATIC_CONSTANT(league,length) = 5556.0*meters; -BOOST_UNITS_STATIC_CONSTANT(leagues,length) = 5556.0*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(league,5556.0*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(leagues,5556.0*meters); -BOOST_UNITS_STATIC_CONSTANT(mile,length) = 1852.0*meters; -BOOST_UNITS_STATIC_CONSTANT(miles,length) = 1852.0*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(mile,1852.0*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(miles,1852.0*meters); } // namespace nautical @@ -121,125 +133,125 @@ // conversions from http://ts.nist.gov/WeightsAndMeasures/Publications/appxc.cfm#2 // units of length -BOOST_UNITS_STATIC_CONSTANT(inch,length) = 25.4e-3*meters; -BOOST_UNITS_STATIC_CONSTANT(inches,length) = 25.4e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(inch,25.4e-3*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(inches,25.4e-3*meters); -BOOST_UNITS_STATIC_CONSTANT(foot,length) = 0.3048*meters; -BOOST_UNITS_STATIC_CONSTANT(feet,length) = 0.3048*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(foot,0.3048*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(feet,0.3048*meters); -BOOST_UNITS_STATIC_CONSTANT(yard,length) = 0.9144*meters; -BOOST_UNITS_STATIC_CONSTANT(yards,length) = 0.9144*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(yard,0.9144*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(yards,0.9144*meters); -BOOST_UNITS_STATIC_CONSTANT(mile,length) = 1609.344*meters; -BOOST_UNITS_STATIC_CONSTANT(miles,length) = 1609.344*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(mile,1609.344*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(miles,1609.344*meters); // units of area -BOOST_UNITS_STATIC_CONSTANT(square_inch,area) = 645.16e-6*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_inches,area) = 645.16e-6*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_inch,645.16e-6*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_inches,645.16e-6*square_meters); -BOOST_UNITS_STATIC_CONSTANT(square_foot,area) = 9.290304e-2*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_feet,area) = 9.290304e-2*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_foot,9.290304e-2*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_feet,9.290304e-2*square_meters); -BOOST_UNITS_STATIC_CONSTANT(square_yard,area) = 0.83612736*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_yards,area) = 0.83612736*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_yard,0.83612736*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_yards,0.83612736*square_meters); -BOOST_UNITS_STATIC_CONSTANT(square_mile,area) = 2589988.110336*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_miles,area) = 2589988.110336*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_mile,2589988.110336*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_miles,2589988.110336*square_meters); // units of volume -BOOST_UNITS_STATIC_CONSTANT(cubic_inch,volume) = 16.387064e-6*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(cubic_inches,volume) = 16.387064e-6*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(cubic_inch,16.387064e-6*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(cubic_inches,16.387064e-6*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(cubic_foot,volume) = 2.8316846592e-2*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(cubic_feet,volume) = 2.8316846592e-2*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(cubic_foot,2.8316846592e-2*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(cubic_feet,2.8316846592e-2*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(cubic_yard,volume) = 0.764554857984*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(cubic_yards,volume) = 0.764554857984*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(cubic_yard,0.764554857984*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(cubic_yards,0.764554857984*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(minim,volume) = 6.161152e-8*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(minims,volume) = 6.161152e-8*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(minim,6.161152e-8*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(minims,6.161152e-8*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(fluid_dram,volume) = 3.696691e-6*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(fluid_drams,volume) = 3.696691e-6*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(fluid_dram,3.696691e-6*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(fluid_drams,3.696691e-6*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(fluid_ounce,volume) = 2.957353e-5*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(fluid_ounces,volume) = 2.957353e-5*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(fluid_ounce,2.957353e-5*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(fluid_ounces,2.957353e-5*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(gill,volume) = 1.182941e-4*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(gills,volume) = 1.182941e-4*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(gill,1.182941e-4*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(gills,1.182941e-4*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(liquid_pint,volume) = 4.731765e-4*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(liquid_pints,volume) = 4.731765e-4*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(liquid_pint,4.731765e-4*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(liquid_pints,4.731765e-4*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(liquid_quart,volume) = 9.463529e-4*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(liquid_quarts,volume) = 9.463529e-4*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(liquid_quart,9.463529e-4*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(liquid_quarts,9.463529e-4*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(gallon,volume) = 3.785412e-3*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(gallons,volume) = 3.785412e-3*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(gallon,3.785412e-3*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(gallons,3.785412e-3*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(dry_pint,volume) = 5.506105e-4*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(dry_pints,volume) = 5.506105e-4*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(dry_pint,5.506105e-4*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(dry_pints,5.506105e-4*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(dry_quart,volume) = 1.101221e-3*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(dry_quarts,volume) = 1.101221e-3*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(dry_quart,1.101221e-3*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(dry_quarts,1.101221e-3*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(peck,volume) = 8.809768e-3*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(pecks,volume) = 8.809768e-3*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(peck,8.809768e-3*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(pecks,8.809768e-3*cubic_meters); -BOOST_UNITS_STATIC_CONSTANT(bushel,volume) = 3.523907e-2*cubic_meters; -BOOST_UNITS_STATIC_CONSTANT(bushels,volume) = 3.523907e-2*cubic_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(bushel,3.523907e-2*cubic_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(bushels,3.523907e-2*cubic_meters); // units of mass -BOOST_UNITS_STATIC_CONSTANT(avoirdupois_dram,mass) = 1.7718451953125e-3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(avoirdupois_drams,mass) = 1.7718451953125e-3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(dram,mass) = 1.7718451953125e-3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(drams,mass) = 1.7718451953125e-3*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(avoirdupois_dram,1.7718451953125e-3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(avoirdupois_drams,1.7718451953125e-3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(dram,1.7718451953125e-3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(drams,1.7718451953125e-3*kilograms); -BOOST_UNITS_STATIC_CONSTANT(avoirdupois_ounce,mass) = 2.8349523125e-2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(avoirdupois_ounces,mass) = 2.8349523125e-2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(ounce,mass) = 2.8349523125e-2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(ounces,mass) = 2.8349523125e-2*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(avoirdupois_ounce,2.8349523125e-2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(avoirdupois_ounces,2.8349523125e-2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(ounce,2.8349523125e-2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(ounces,2.8349523125e-2*kilograms); -BOOST_UNITS_STATIC_CONSTANT(avoirdupois_pound,mass) = 4.5359237e-1*kilograms; -BOOST_UNITS_STATIC_CONSTANT(avoirdupois_pounds,mass) = 4.5359237e-1*kilograms; -BOOST_UNITS_STATIC_CONSTANT(pound,mass) = 4.5359237e-1*kilograms; -BOOST_UNITS_STATIC_CONSTANT(pounds,mass) = 4.5359237e-1*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(avoirdupois_pound,4.5359237e-1*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(avoirdupois_pounds,4.5359237e-1*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(pound,4.5359237e-1*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(pounds,4.5359237e-1*kilograms); -BOOST_UNITS_STATIC_CONSTANT(short_hundredweight,mass) = 4.5359237e1*kilograms; -BOOST_UNITS_STATIC_CONSTANT(short_hundredweights,mass) = 4.5359237e1*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(short_hundredweight,4.5359237e1*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(short_hundredweights,4.5359237e1*kilograms); -BOOST_UNITS_STATIC_CONSTANT(short_ton,mass) = 9.0718474e2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(short_tons,mass) = 9.0718474e2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(ton,mass) = 9.0718474e2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(tons,mass) = 9.0718474e2*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(short_ton,9.0718474e2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(short_tons,9.0718474e2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(ton,9.0718474e2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(tons,9.0718474e2*kilograms); -BOOST_UNITS_STATIC_CONSTANT(long_ton,mass) = 1.0160469088e3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(long_tons,mass) = 1.0160469088e3*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(long_ton,1.0160469088e3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(long_tons,1.0160469088e3*kilograms); -BOOST_UNITS_STATIC_CONSTANT(grain,mass) = 6.479891e-5*kilograms; -BOOST_UNITS_STATIC_CONSTANT(grains,mass) = 6.479891e-5*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(grain,6.479891e-5*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(grains,6.479891e-5*kilograms); -BOOST_UNITS_STATIC_CONSTANT(apothecaries_scruple,mass) = 1.2959782e-3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(apothecaries_scruples,mass) = 1.2959782e-3*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_scruple,1.2959782e-3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_scruples,1.2959782e-3*kilograms); -BOOST_UNITS_STATIC_CONSTANT(pennyweight,mass) = 1.55517384e-3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(pennyweights,mass) = 1.55517384e-3*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(pennyweight,1.55517384e-3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(pennyweights,1.55517384e-3*kilograms); -BOOST_UNITS_STATIC_CONSTANT(apothecaries_dram,mass) = 3.8879346e-3*kilograms; -BOOST_UNITS_STATIC_CONSTANT(apothecaries_drams,mass) = 3.8879346e-3*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_dram,3.8879346e-3*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_drams,3.8879346e-3*kilograms); -BOOST_UNITS_STATIC_CONSTANT(apothecaries_ounce,mass) = 3.11034768e-2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(apothecaries_ounces,mass) = 3.11034768e-2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(troy_ounce,mass) = 3.11034768e-2*kilograms; -BOOST_UNITS_STATIC_CONSTANT(troy_ounces,mass) = 3.11034768e-2*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_ounce,3.11034768e-2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_ounces,3.11034768e-2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(troy_ounce,3.11034768e-2*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(troy_ounces,3.11034768e-2*kilograms); -BOOST_UNITS_STATIC_CONSTANT(apothecaries_pound,mass) = 3.732417216e-1*kilograms; -BOOST_UNITS_STATIC_CONSTANT(apothecaries_pounds,mass) = 3.732417216e-1*kilograms; -BOOST_UNITS_STATIC_CONSTANT(troy_pound,mass) = 3.732417216e-1*kilograms; -BOOST_UNITS_STATIC_CONSTANT(troy_pounds,mass) = 3.732417216e-1*kilograms; +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_pound,3.732417216e-1*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(apothecaries_pounds,3.732417216e-1*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(troy_pound,3.732417216e-1*kilograms); +BOOST_UNITS_AUTO_STATIC_CONSTANT(troy_pounds,3.732417216e-1*kilograms); // units of velocity -BOOST_UNITS_STATIC_CONSTANT(miles_per_hour,velocity) = (1609.344/3600.0)*meters_per_second; +BOOST_UNITS_AUTO_STATIC_CONSTANT(miles_per_hour,(1609.344/3600.0)*meters_per_second); } // namespace us @@ -251,36 +263,36 @@ // conversions from http://ts.nist.gov/WeightsAndMeasures/Publications/appxc.cfm#2 // units of length -BOOST_UNITS_STATIC_CONSTANT(link,length) = 0.2011684*meters; -BOOST_UNITS_STATIC_CONSTANT(links,length) = 0.2011684*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(link,0.2011684*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(links,0.2011684*meters); -BOOST_UNITS_STATIC_CONSTANT(foot,length) = 0.3048006*meters; -BOOST_UNITS_STATIC_CONSTANT(feet,length) = 0.3048006*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(foot,0.3048006*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(feet,0.3048006*meters); -BOOST_UNITS_STATIC_CONSTANT(rod,length) = 5.029210*meters; -BOOST_UNITS_STATIC_CONSTANT(rods,length) = 5.029210*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(rod,5.029210*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(rods,5.029210*meters); -BOOST_UNITS_STATIC_CONSTANT(chain,length) = 20.11684*meters; -BOOST_UNITS_STATIC_CONSTANT(chains,length) = 20.11684*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(chain,20.11684*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(chains,20.11684*meters); -BOOST_UNITS_STATIC_CONSTANT(mile,length) = 1609.347*meters; -BOOST_UNITS_STATIC_CONSTANT(miles,length) = 1609.347*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(mile,1609.347*meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(miles,1609.347*meters); // units of area -BOOST_UNITS_STATIC_CONSTANT(square_foot,area) = 0.09290341*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_feet,area) = 0.09290341*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_foot,0.09290341*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_feet,0.09290341*square_meters); -BOOST_UNITS_STATIC_CONSTANT(square_rod,area) = 25.29295*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_rods,area) = 25.29295*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_rod,25.29295*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_rods,25.29295*square_meters); -BOOST_UNITS_STATIC_CONSTANT(square_chain,area) = 404.6873*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_chains,area) = 404.6873*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_chain,404.6873*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_chains,404.6873*square_meters); -BOOST_UNITS_STATIC_CONSTANT(acre,area) = 4046.873*square_meters; -BOOST_UNITS_STATIC_CONSTANT(acres,area) = 4046.873*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(acre,4046.873*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(acres,4046.873*square_meters); -BOOST_UNITS_STATIC_CONSTANT(square_mile,area) = 2589998.0*square_meters; -BOOST_UNITS_STATIC_CONSTANT(square_miles,area) = 2589998.0*square_meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_mile,2589998.0*square_meters); +BOOST_UNITS_AUTO_STATIC_CONSTANT(square_miles,2589998.0*square_meters); } // namespace survey @@ -290,97 +302,97 @@ namespace english { /// barleycorn -BOOST_UNITS_STATIC_CONSTANT(barleycorn,length) = 8.466667e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(barleycorn,8.466667e-3*meters); /// cubit -BOOST_UNITS_STATIC_CONSTANT(cubit,length) = 0.4572*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(cubit,0.4572*meters); /// ell -BOOST_UNITS_STATIC_CONSTANT(ell,length) = 1.143*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(ell,1.143*meters); /// fathom -BOOST_UNITS_STATIC_CONSTANT(fathom,length) = 1.8288*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(fathom,1.8288*meters); /// finger -BOOST_UNITS_STATIC_CONSTANT(finger,length) = 22.225e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(finger,22.225e-3*meters); /// furlong -BOOST_UNITS_STATIC_CONSTANT(furlong,length) = 201.168*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(furlong,201.168*meters); /// hand -BOOST_UNITS_STATIC_CONSTANT(hand,length) = 0.1016*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(hand,0.1016*meters); /// league -BOOST_UNITS_STATIC_CONSTANT(league,length) = 4828.032*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(league,4828.032*meters); /// palm -BOOST_UNITS_STATIC_CONSTANT(palm,length) = 76.2e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(palm,76.2e-3*meters); /// rod -BOOST_UNITS_STATIC_CONSTANT(rod,length) = 5.0292*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(rod,5.0292*meters); } // namespace english namespace imperial { /// cable (Imperial) -BOOST_UNITS_STATIC_CONSTANT(cable,length) = 185.3184*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(cable,185.3184*meters); } // namespace imperial /// atomic unit -BOOST_UNITS_STATIC_CONSTANT(atomic_unit,length) = 5.291772083e-11*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(atomic_unit,5.291772083e-11*meters); /// Bohr radius -BOOST_UNITS_STATIC_CONSTANT(bohr_radius,length) = atomic_unit; +BOOST_UNITS_AUTO_STATIC_CONSTANT(bohr_radius,atomic_unit); /// cable (US) -BOOST_UNITS_STATIC_CONSTANT(us_cable,length) = 219.456*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(us_cable,219.456*meters); /// calibre -BOOST_UNITS_STATIC_CONSTANT(calibre,length) = 25.4e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(calibre,25.4e-3*meters); /// chain (surveyor's) -BOOST_UNITS_STATIC_CONSTANT(surveyors_chain,length) = 20.1168*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(surveyors_chain,20.1168*meters); /// chain (engineer's) -BOOST_UNITS_STATIC_CONSTANT(engineers_chain,length) = 30.48*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(engineers_chain,30.48*meters); /// finger (cloth) -BOOST_UNITS_STATIC_CONSTANT(cloth_finger,length) = 0.1143*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(cloth_finger,0.1143*meters); /// foot (Benoit) -BOOST_UNITS_STATIC_CONSTANT(benoit_foot,length) = 0.304799735*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(benoit_foot,0.304799735*meters); /// foot (Clarke's) -BOOST_UNITS_STATIC_CONSTANT(clarkes_foot,length) = 0.3047972654*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(clarkes_foot,0.3047972654*meters); /// foot (Indian) -BOOST_UNITS_STATIC_CONSTANT(indian_foot,length) = 0.304799514*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(indian_foot,0.304799514*meters); /// foot (Sear's) -BOOST_UNITS_STATIC_CONSTANT(sears_foot,length) = 0.30479947*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(sears_foot,0.30479947*meters); /// foot (US Survey) -BOOST_UNITS_STATIC_CONSTANT(us_foot,length) = (1200.0/3937.0)*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(us_foot,(1200.0/3937.0)*meters); /// mile, geographical -BOOST_UNITS_STATIC_CONSTANT(geographical_mile,length) = 1853.7936*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(geographical_mile,1853.7936*meters); /// line -BOOST_UNITS_STATIC_CONSTANT(line,length) = 2.116667e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(line,2.116667e-3*meters); /// link (surveyor's) -BOOST_UNITS_STATIC_CONSTANT(surveyors_link,length) = 0.201168*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(surveyors_link,0.201168*meters); /// link (engineer's) -BOOST_UNITS_STATIC_CONSTANT(engineers_link,length) = 0.3048*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(engineers_link,0.3048*meters); /// mickey -BOOST_UNITS_STATIC_CONSTANT(mickey,length) = 1.27e-4*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(mickey,1.27e-4*meters); /// mil -BOOST_UNITS_STATIC_CONSTANT(mil,length) = 2.54e-5*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(mil,2.54e-5*meters); /// mile (US survey) -BOOST_UNITS_STATIC_CONSTANT(mile_us,length) = 1609.347219*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(mile_us,1609.347219*meters); /// nail (cloth) -BOOST_UNITS_STATIC_CONSTANT(nail,length) = 57.15e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(nail,57.15e-3*meters); /// mile (Admiralty nautical) -BOOST_UNITS_STATIC_CONSTANT(admiralty_nautical_mile,length) = 1853.184*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(admiralty_nautical_mile,1853.184*meters); /// pace -BOOST_UNITS_STATIC_CONSTANT(pace,length) = 0.762*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(pace,0.762*meters); /// point (ATA) -BOOST_UNITS_STATIC_CONSTANT(ata_point,length) = 0.3514598e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(ata_point,0.3514598e-3*meters); /// point (Didot) -BOOST_UNITS_STATIC_CONSTANT(didot_point,length) = 0.376065e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(didot_point,0.376065e-3*meters); /// point (metric) -BOOST_UNITS_STATIC_CONSTANT(point,length) = 0.375e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(point,0.375e-3*meters); /// point (PostScript) -BOOST_UNITS_STATIC_CONSTANT(postscript_point,length) = 0.352778e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(postscript_point,0.352778e-3*meters); /// quarter -BOOST_UNITS_STATIC_CONSTANT(quarter,length) = 0.2286*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(quarter,0.2286*meters); /// rope -BOOST_UNITS_STATIC_CONSTANT(rope,length) = 6.096*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(rope,6.096*meters); /// span -BOOST_UNITS_STATIC_CONSTANT(span,length) = 0.1524*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(span,0.1524*meters); /// span (cloth) -BOOST_UNITS_STATIC_CONSTANT(cloth_span,length) = 0.2286*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(cloth_span,0.2286*meters); /// stick -BOOST_UNITS_STATIC_CONSTANT(stick,length) = 50.8e-3*meters; +BOOST_UNITS_AUTO_STATIC_CONSTANT(stick,50.8e-3*meters); */ } // constants |
|
From: Jan G. <jan...@us...> - 2007-04-09 22:06:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2309/boost/circular_buffer Modified Files: base.hpp details.hpp space_optimized.hpp Log Message: circular_buffer: updated srcdoc and test cases Index: space_optimized.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/space_optimized.hpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- space_optimized.hpp 8 Apr 2007 22:10:24 -0000 1.25 +++ space_optimized.hpp 9 Apr 2007 22:06:13 -0000 1.26 @@ -18,27 +18,18 @@ /*! \class circular_buffer_space_optimized \brief Space optimized circular buffer container adaptor. - \param T The type of the elements stored in the space optimized circular buffer. - \par Type Requirements T - The <code>T</code> has to be <a href="http://www.sgi.com/tech/stl/Assignable.html"> - SGIAssignable</a> (SGI STL defined combination of <a href="../../utility/Assignable.html"> - Assignable</a> and <a href="../../utility/CopyConstructible.html">CopyConstructible</a>). - Moreover <code>T</code> has to be <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html"> - DefaultConstructible</a> if supplied as a default parameter when invoking some of the methods. - \param Alloc The allocator type used for all internal memory management. - \par Type Requirements Alloc - The <code>Alloc</code> has to meet the allocator requirements imposed by STL. - \par Default Alloc - std::allocator<T> - \author Jan Gaspar - \version 1.4 - \date 2007 For detailed documentation of the space_optimized_circular_buffer visit: - http://www.boost.org/libs/circular_buffer/doc/circular_buffer_adaptor.html + http://www.boost.org/libs/circular_buffer/doc/circular_buffer_space_optimized.html */ template <class T, class Alloc> -class circular_buffer_space_optimized : private circular_buffer<T, Alloc> { +class circular_buffer_space_optimized : +/*! \cond */ +#if BOOST_CB_ENABLE_DEBUG +public +#endif +/*! \endcond */ +circular_buffer<T, Alloc> { public: // Typedefs @@ -63,27 +54,31 @@ //! Capacity controller of the space optimized circular buffer. /*! <p><pre> - struct capacity_control { - capacity_control(size_type capacity, size_type min_capacity = 0) m_capacity(capacity), m_min_capacity(min_capacity) {}; - size_type m_capacity; - size_type m_min_capacity; - }; - </pre></p> +class capacity_control { + size_type m_capacity; + size_type m_min_capacity; +public: + capacity_control(size_type capacity, size_type min_capacity = 0) : m_capacity(capacity), m_min_capacity(min_capacity) {}; + size_type %capacity() const { return m_capacity; } + size_type min_capacity() const { return m_min_capacity; } + operator size_type() const { return m_capacity; } +};</pre></p> \pre <code>capacity >= min_capacity</code> - <p>The <code>m_capacity</code> denotes the capacity of the - <code>circular_buffer_space_optimized</code> and the <code>m_min_capacity</code> - determines the minimal allocated size of its internal buffer.</p> - <p>The converting constructor of the <code>capacity_control</code> - allows implicit conversion from <code>size_type</code> like types - which ensures compatibility of creating an instance of the - <code>circular_buffer_space_optimized</code> with other STL containers.</p> + <p>The <code>m_capacity</code> represents the capacity of the <code>circular_buffer_space_optimized</code> and + the <code>m_min_capacity</code> determines the minimal allocated size of its internal buffer.</p> + <p>The converting constructor of the <code>capacity_control</code> allows implicit conversion from + <code>size_type</code>-like types which ensures compatibility of creating an instance of the + <code>circular_buffer_space_optimized</code> with other STL containers. On the other hand the operator + <code>%size_type()</code> (returning <code>m_capacity</code>) provides implicit conversion to the + <code>size_type</code> which allows to treat the capacity of the <code>circular_buffer_space_optimized</code> + the same way as in the <code><a href="circular_buffer.html">circular_buffer</a></code>.</p> */ typedef cb_details::capacity_control<size_type, T, Alloc> capacity_type; #else /*! \cond */ typedef cb_details::capacity_control<size_type> capacity_type; /*! \endcond */ -#endif +#endif // #if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) // Inherited @@ -118,13 +113,48 @@ public: // Overridden - //! See the circular_buffer source documentation. - bool full() const { return capacity() == size(); } + //! Is the <code>circular_buffer_space_optimized</code> full? + /*! + \return <code>true</code> if the number of elements stored in the <code>circular_buffer_space_optimized</code> + equals the capacity of the <code>circular_buffer_space_optimized</code>; <code>false</code> otherwise. + \throws Nothing. + \par Exception Safety + No-throw. + \par Iterator Invalidation + Does not invalidate any iterators. + \par Complexity + Constant (in the size of the <code>circular_buffer_space_optimized</code>). + \sa <code>empty()</code> + */ + bool full() const { return m_capacity_ctrl.capacity() == size(); } - //! See the circular_buffer source documentation. - size_type reserve() const { return capacity() - size(); } + /*! \brief Get the maximum number of elements which can be inserted into the + <code>circular_buffer_space_optimized</code> without overwriting any of already stored elements. + \return <code>capacity() - size()</code> + \throws Nothing. + \par Exception Safety + No-throw. + \par Iterator Invalidation + Does not invalidate any iterators. + \par Complexity + Constant (in the size of the <code>circular_buffer_space_optimized</code>). + \sa <code>capacity()</code>, <code>size()</code>, <code>max_size()</code> + */ + size_type reserve() const { return m_capacity_ctrl.capacity() - size(); } - //! See the circular_buffer source documentation. + //! Get the capacity of the <code>circular_buffer_space_optimized</code>. + /*! + \return The capacity controller representing the maximum number of elements which can be stored in the + <code>circular_buffer_space_optimized</code> and the minimal allocated size of the internal buffer. + \throws Nothing. + \par Exception Safety + No-throw. + \par Iterator Invalidation + Does not invalidate any iterators. + \par Complexity + Constant (in the size of the <code>circular_buffer_space_optimized</code>). + \sa <code>reserve()</code>, <code>size()</code>, <code>max_size()</code>, <code>set_capacity()</code> + */ const capacity_type& capacity() const { return m_capacity_ctrl; } #if defined(BOOST_CB_TEST) @@ -138,28 +168,69 @@ #endif // #if defined(BOOST_CB_TEST) - //! TODO Change the minimal guaranteed amount of allocated memory. - /*! - \pre <code>(*this).capacity() >= new_min_capacity</code> - \post <code>(*this).min_capacity() == new_min_capacity</code> - Allocates memory specified by the <code>new_min_capacity</code> parameter. - \note It is considered as a bug if the precondition is not met (i.e. if - <code>new_min_capacity > (*this).capacity()</code>) and an assertion - will be invoked in the debug mode. - - \pre <code>min_capacity() <= new_capacity</code> - \note It is considered as a bug if the precondition is not met (i.e. if - <code>new_capacity > min_capacity()</code>) and an assertion - will be invoked in the debug mode. + /*! \brief Change the capacity (and the minimal guaranteed amount of allocated memory) of the + <code>circular_buffer_space_optimized</code>. + \post <code>capacity() == capacity_ctrl \&\& size() \<= capacity_ctrl.capacity()</code><br><br> + If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater + than the desired new capacity then number of <code>[size() - capacity_ctrl.capacity()]</code> <b>last</b> + elements will be removed and the new size will be equal to <code>capacity_ctrl.capacity()</code>.<br><br> + If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is lower + than than the new capacity the allocated memory (in the internal buffer) may be accommodated as necessary + but it will never drop below <code>capacity_ctrl.min_capacity()</code>. + \param capacity_ctrl The new capacity controller. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Strong. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the size/new capacity of the <code>circular_buffer_space_optimized</code>). + \note To explicitly clear the extra allocated memory use the <b>shrink-to-fit</b> technique:<br><br> + <code>boost::%circular_buffer_space_optimized\<int\> cb(1000);<br> + ...<br> + boost::%circular_buffer_space_optimized\<int\>(cb).swap(cb);</code><br><br> + For more information about the shrink-to-fit technique in STL see + <a href="http://www.gotw.ca/gotw/054.htm">http://www.gotw.ca/gotw/054.htm</a>. + \sa <code>rset_capacity()</code>, <code>resize()</code> */ - void set_capacity(const capacity_type& new_capacity) { - m_capacity_ctrl = new_capacity; - if (new_capacity.capacity() < circular_buffer<T, Alloc>::capacity()) - circular_buffer<T, Alloc>::set_capacity(new_capacity.capacity()); - set_min_capacity(new_capacity.min_capacity()); + void set_capacity(const capacity_type& capacity_ctrl) { + m_capacity_ctrl = capacity_ctrl; + if (capacity_ctrl.capacity() < circular_buffer<T, Alloc>::capacity()) + circular_buffer<T, Alloc>::set_capacity(capacity_ctrl.capacity()); + set_min_capacity(capacity_ctrl.min_capacity()); +#if BOOST_CB_ENABLE_DEBUG + invalidate_iterators_except(end()); +#endif } - //! See the circular_buffer source documentation. + //! Change the size of the <code>circular_buffer_space_optimized</code>. + /*! + \post <code>size() == new_size \&\& capacity().%capacity() >= new_size</code><br><br> + If the new size is greater than the current size, copies of <code>item</code> will be inserted at the + <b>back</b> of the of the <code>circular_buffer_space_optimized</code> in order to achieve the desired + size. In the case the resulting size exceeds the current capacity the capacity will be set to + <code>new_size</code>.<br><br> + If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater + than the desired new size then number of <code>[size() - new_size]</code> <b>last</b> elements will be + removed. (The capacity will remain unchanged.) + \param new_size The new size. + \param item The element the <code>circular_buffer_space_optimized</code> will be filled with in order to gain + the requested size. (See the <i>Effect</i>.) + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Basic. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the new size of the <code>circular_buffer_space_optimized</code>). + \sa <code>rresize()</code>, <code>set_capacity()</code> + */ void resize(size_type new_size, param_value_type item = value_type()) { if (new_size > size()) { if (new_size > capacity()) @@ -168,36 +239,90 @@ } else { erase(end() - (size() - new_size), end()); } +#if BOOST_CB_ENABLE_DEBUG + invalidate_iterators_except(end()); +#endif } - //! See the circular_buffer source documentation. - /*! - \pre <code>min_capacity() <= new_capacity</code> - \note It is considered as a bug if the precondition is not met (i.e. if - <code>new_capacity > min_capacity()</code>) and an assertion - will be invoked in the debug mode. + /*! \brief Change the capacity (and the minimal guaranteed amount of allocated memory) of the + <code>circular_buffer_space_optimized</code>. + \post <code>capacity() == capacity_ctrl \&\& size() \<= capacity_ctrl</code><br><br> + If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater + than the desired new capacity then number of <code>[size() - capacity_ctrl.capacity()]</code> + <b>first</b> elements will be removed and the new size will be equal to + <code>capacity_ctrl.capacity()</code>.<br><br> + If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is lower + than than the new capacity the allocated memory (in the internal buffer) may be accommodated as necessary + but it will never drop below <code>capacity_ctrl.min_capacity()</code>. + \param capacity_ctrl The new capacity controller. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Strong. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the size/new capacity of the <code>circular_buffer_space_optimized</code>). + \sa <code>set_capacity()</code>, <code>rresize()</code> */ - void rset_capacity(const capacity_type& new_capacity) { - m_capacity_ctrl = new_capacity; - if (new_capacity.capacity() < circular_buffer<T, Alloc>::capacity()) - circular_buffer<T, Alloc>::rset_capacity(new_capacity.capacity()); - set_min_capacity(new_capacity.min_capacity()); + void rset_capacity(const capacity_type& capacity_ctrl) { + m_capacity_ctrl = capacity_ctrl; + if (capacity_ctrl.capacity() < circular_buffer<T, Alloc>::capacity()) + circular_buffer<T, Alloc>::rset_capacity(capacity_ctrl.capacity()); + set_min_capacity(capacity_ctrl.min_capacity()); +#if BOOST_CB_ENABLE_DEBUG + invalidate_iterators_except(end()); +#endif } - //! See the circular_buffer source documentation. + //! Change the size of the <code>circular_buffer_space_optimized</code>. + /*! + \post <code>size() == new_size \&\& capacity().%capacity() >= new_size</code><br><br> + If the new size is greater than the current size, copies of <code>item</code> will be inserted at the + <b>front</b> of the of the <code>circular_buffer_space_optimized</code> in order to achieve the desired + size. In the case the resulting size exceeds the current capacity the capacity will be set to + <code>new_size</code>.<br><br> + If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater + than the desired new size then number of <code>[size() - new_size]</code> <b>first</b> elements will be + removed. (The capacity will remain unchanged.) + \param new_size The new size. + \param item The element the <code>circular_buffer_space_optimized</code> will be filled with in order to gain + the requested size. (See the <i>Effect</i>.) + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Basic. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the new size of the <code>circular_buffer_space_optimized</code>). + \sa <code>rresize()</code>, <code>set_capacity()</code> + */ void rresize(size_type new_size, param_value_type item = value_type()) { if (new_size > size()) { if (new_size > capacity()) m_capacity_ctrl.m_capacity = new_size; - insert(begin(), new_size - size(), item); + rinsert(begin(), new_size - size(), item); } else { - erase(begin(), end() - new_size); + rerase(begin(), end() - new_size); } +#if BOOST_CB_ENABLE_DEBUG + invalidate_iterators_except(end()); +#endif } //! Create an empty space optimized circular buffer with a maximum capacity. /*! - TODO - doc + \post <code>capacity().%capacity() == max_size() \&\& capacity().min_capacity() == 0 \&\& size() == 0</code> + <br><br>There is no memory allocated in the internal buffer after execution of this constructor. + \param alloc The allocator. + \throws Nothing. + \par Complexity + Constant. */ explicit circular_buffer_space_optimized( const allocator_type& alloc = allocator_type()) @@ -206,17 +331,15 @@ //! Create an empty space optimized circular buffer with the specified capacity. /*! - \param capacity_ctrl The capacity of the buffer. - (param min_capacity The minimal guaranteed amount of allocated memory.) - (The metrics of the min_capacity is number of items.) + \post <code>capacity() == capacity_ctrl \&\& size() == 0</code> + \param capacity_ctrl The capacity controller representing the maximum number of elements which can be stored in + the <code>circular_buffer_space_optimized</code> and the minimal allocated size of the + internal buffer. \param alloc The allocator. - \pre <code>capacity >= min_capacity</code> - \post <code>(*this).capacity() == capacity \&\& (*this).size == 0</code><br> - Allocates memory specified by the <code>min_capacity</code> parameter. - \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is used). - \note It is considered as a bug if the precondition is not met (i.e. if - <code>capacity < min_capacity</code>) and an assertion will be invoked - in the debug mode. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \par Complexity + Constant. */ explicit circular_buffer_space_optimized( capacity_type capacity_ctrl, @@ -224,20 +347,21 @@ : circular_buffer<T, Alloc>(capacity_ctrl.m_min_capacity, alloc) , m_capacity_ctrl(capacity_ctrl) {} - //! Create a full space optimized circular buffer filled with copies of <code>item</code>. - /*! - \param capacity_ctrl The capacity of the buffer. - (param min_capacity The minimal guaranteed amount of allocated memory.) - (The metrics of the min_capacity is number of items.) - \param item The item to be filled with. + /*! \brief Create a full space optimized circular buffer with the specified capacity (and the minimal guaranteed + amount of allocated memory) filled with <code>capacity_ctrl.%capacity()</code> copies of + <code>item</code>. + \post <code>capacity() == capacity_ctrl \&\& full() \&\& (*this)[0] == item \&\& (*this)[1] == item \&\& ... + \&\& (*this) [capacity_ctrl.%capacity() - 1] == item </code> + \param capacity_ctrl The capacity controller representing the maximum number of elements which can be stored in + the <code>circular_buffer_space_optimized</code> and the minimal allocated size of the + internal buffer. + \param item The element the created <code>circular_buffer_space_optimized</code> will be filled with. \param alloc The allocator. - \pre <code>capacity >= min_capacity</code> - \post <code>(*this).size() == capacity \&\& (*this)[0] == (*this)[1] == ... == (*this).back() == item</code> - \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is used). - \throws Whatever T::T(const T&) throws. - \note It is considered as a bug if the precondition is not met (i.e. if - <code>capacity < min_capacity</code>) and an assertion will be invoked - in the debug mode. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Complexity + Linear (in the <code>capacity_ctrl.%capacity()</code>). */ circular_buffer_space_optimized( capacity_type capacity_ctrl, @@ -246,7 +370,24 @@ : circular_buffer<T, Alloc>(capacity_ctrl.m_capacity, item, alloc) , m_capacity_ctrl(capacity_ctrl) {} - //! TODO doc + /*! \brief Create a space optimized circular buffer with the specified capacity (and the minimal guaranteed amount + of allocated memory) filled with <code>n</code> copies of <code>item</code>. + \pre <code>capacity_ctrl.%capacity() >= n</code> + \post <code>capacity() == capacity_ctrl \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item + \&\& ... \&\& (*this)[n - 1] == item</code><br><br> + Allocates at least as much memory as specified by the <code>capacity_ctrl.min_capacity()</code>. + \param capacity_ctrl The capacity controller representing the maximum number of elements which can be stored in + the <code>circular_buffer_space_optimized</code> and the minimal allocated size of the + internal buffer. + \param n The number of elements the created <code>circular_buffer_space_optimized</code> will be filled with. + \param item The element the created <code>circular_buffer_space_optimized</code> will be filled with. + \param alloc The allocator. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Complexity + Linear (in the <code>n</code>). + */ circular_buffer_space_optimized( capacity_type capacity_ctrl, size_type n, @@ -255,21 +396,13 @@ : circular_buffer<T, Alloc>(init_capacity(capacity_ctrl, n), n, item, alloc) , m_capacity_ctrl(capacity_ctrl) {} -#if defined(BOOST_CB_NEVER_DEFINED) - - // Default copy constructor - declared only for documentation purpose. - /* - \note This section will never be compiled. The default copy constructor - will be generated instead. - */ - //! TODO doc - circular_buffer_space_optimized(const circular_buffer_space_optimized<T, Alloc>& cb); - -#endif // #if defined(BOOST_CB_NEVER_DEFINED) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + /*! \cond */ + circular_buffer_space_optimized(const circular_buffer_space_optimized<T, Alloc>& cb) + : circular_buffer<T, Alloc>(cb.begin(), cb.end()) + , m_capacity_ctrl(cb.m_capacity_ctrl) {} - // TODO describe workaround template <class InputIterator> circular_buffer_space_optimized( InputIterator first, @@ -277,7 +410,6 @@ : circular_buffer<T, Alloc>(first, last) , m_capacity_ctrl(circular_buffer<T, Alloc>::capacity()) {} - // TODO describe workaround template <class InputIterator> circular_buffer_space_optimized( capacity_type capacity_ctrl, @@ -289,10 +421,43 @@ , m_capacity_ctrl(capacity_ctrl) { check_high_capacity(is_integral<InputIterator>()); } + /*! \endcond */ #else - //! TODO doc + //! The copy constructor. + /*! + Creates a copy of the specified <code>circular_buffer_space_optimized</code>. + \post <code>*this == cb</code><br><br> + Allocates the exact amount of memory to store the content of <code>cb</code>. + \param cb The <code>circular_buffer_space_optimized</code> to be copied. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Complexity + Linear (in the size of <code>cb</code>). + */ + circular_buffer_space_optimized(const circular_buffer_space_optimized<T, Alloc>& cb) + : circular_buffer<T, Alloc>(cb.begin(), cb.end(), cb.get_allocator()) + , m_capacity_ctrl(cb.m_capacity_ctrl) {} + + //! Create a full space optimized circular buffer filled with a copy of the range. + /*! + \pre Valid range <code>[first, last)</code>.<br> + <code>first</code> and <code>last</code> have to meet the requirements of + <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. + \post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\& + full() \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ... \&\& + (*this)[std::distance(first, last) - 1] == *(last - 1)</code> + \param first The beginning of the range to be copied. + \param last The end of the range to be copied. + \param alloc The allocator. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Complexity + Linear (in the <code>std::distance(first, last)</code>). + */ template <class InputIterator> circular_buffer_space_optimized( InputIterator first, @@ -301,28 +466,29 @@ : circular_buffer<T, Alloc>(first, last, alloc) , m_capacity_ctrl(circular_buffer<T, Alloc>::capacity()) {} - - //! Create a space optimized circular buffer with a copy of a range. - /*! - \param capacity_ctrl The capacity of the buffer. - (param min_capacity The minimal guaranteed amount of allocated memory.) - (The metrics of the min_capacity is number of items.) - \param first The beginning of the range. - \param last The end of the range. + /*! \brief Create a space optimized circular buffer with the specified capacity (and the minimal guaranteed amount + of allocated memory) filled with a copy of the range. + \pre Valid range <code>[first, last)</code>.<br> + <code>first</code> and <code>last</code> have to meet the requirements of + <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. + \post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\& (*this)[0]== + *(last - capacity_ctrl.%capacity()) \&\& (*this)[1] == *(last - capacity_ctrl.%capacity() + 1) \&\& ... + \&\& (*this)[capacity_ctrl.%capacity() - 1] == *(last - 1)</code><br><br> + Allocates at least as much memory as specified by the <code>capacity_ctrl.min_capacity()</code>.<br><br> + If the number of items to be copied from the range <code>[first, last)</code> is greater than the + specified <code>capacity_ctrl.%capacity()</code> then only elements from the range + <code>[last - capacity_ctrl.%capacity(), last)</code> will be copied. + \param capacity_ctrl The capacity controller representing the maximum number of elements which can be stored in + the <code>circular_buffer_space_optimized</code> and the minimal allocated size of the + internal buffer. + \param first The beginning of the range to be copied. + \param last The end of the range to be copied. \param alloc The allocator. - \pre <code>capacity >= min_capacity</code> and valid range <code>[first, last)</code>. - \post <code>(*this).capacity() == capacity</code><br> - Allocates at least as much memory as specified by the - TODO change - <code>min_capacity</code> parameter.<br> - If the number of items to copy from the range - <code>[first, last)</code> is greater than the specified - <code>capacity</code> then only elements from the range - <code>[last - capacity, last)</code> will be copied. - \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is used). - \throws Whatever T::T(const T&) throws. - \note It is considered as a bug if the precondition is not met (i.e. if - <code>capacity < min_capacity</code>) and an assertion will be invoked - in the debug mode. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Complexity + Linear (in the <code>capacity_ctrl.%capacity()</code>/<code>std::distance(first, last)</code>). */ template <class InputIterator> circular_buffer_space_optimized( @@ -337,20 +503,25 @@ check_high_capacity(is_integral<InputIterator>()); } -#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) #if defined(BOOST_CB_NEVER_DEFINED) +// This section will never be compiled - the default destructor and assignment operator will be generated instead. +// Declared only for documentation purpose. - // Default destructor - //! TODO doc + //! The destructor. + /*! + Destroys the <code>circular_buffer_space_optimized</code>. + \throws Nothing. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (including + iterators equal to end()). + \par Complexity + Linear (in the size of the <code>circular_buffer_space_optimized</code>). + \sa <code>clear()</code> + */ ~circular_buffer_space_optimized(); - - // Assignment operator - declared only for documentation purpose. - /* - \note This section will never be compiled. The default assignment - operator will be generated instead. - */ //! TODO doc circular_buffer_space_optimized<T, Alloc>& operator = (const circular_buffer_space_optimized<T, Alloc>& cb); @@ -614,15 +785,15 @@ ensure_reserve(new_capacity, size())); } - //! TODO doc + //! Specialized method for checking of the high capacity. void check_high_capacity(const true_type&) {} - //! TODO doc + //! Specialized method for checking of the high capacity. void check_high_capacity(const false_type&) { check_high_capacity(); } - //! TODO doc + //! Determine the initial capacity. static size_type init_capacity(const capacity_type& capacity_ctrl, size_type n) { BOOST_CB_ASSERT(capacity_ctrl.m_capacity >= n); // check for capacity lower than n return std::max(capacity_ctrl.m_min_capacity, n); Index: details.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/details.hpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- details.hpp 8 Apr 2007 22:10:24 -0000 1.25 +++ details.hpp 9 Apr 2007 22:06:13 -0000 1.26 @@ -166,10 +166,10 @@ // Default assign operator. - // Get the capacity of the space optimized circular buffer. + //! Get the capacity of the space optimized circular buffer. Size capacity() const { return m_capacity; } - // Get the minimal capacity of the space optimized circular buffer. + //! Get the minimal capacity of the space optimized circular buffer. Size min_capacity() const { return m_min_capacity; } //! Size operator - returns the capacity of the space optimized circular buffer. Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.83 retrieving revision 1.84 diff -u -d -r1.83 -r1.84 --- base.hpp 8 Apr 2007 22:10:24 -0000 1.83 +++ base.hpp 9 Apr 2007 22:06:13 -0000 1.84 @@ -52,9 +52,6 @@ The <code>Alloc</code> has to meet the allocator requirements imposed by STL. \par Default Alloc std::allocator<T> - \author Jan Gaspar - \version 3.7 - \date 2007 For detailed documentation of the circular_buffer visit: http://www.boost.org/libs/circular_buffer/doc/circular_buffer.html @@ -64,7 +61,7 @@ /*! \cond */ #if BOOST_CB_ENABLE_DEBUG : public cb_details::debug_iterator_registry -#endif // #if BOOST_CB_ENABLE_DEBUG +#endif /*! \endcond */ { @@ -800,7 +797,7 @@ capacity will remain unchanged.) \param new_size The new size. \param item The element the <code>circular_buffer</code> will be filled with in order to gain the requested - size. (See the postcondition.) + size. (See the <i>Effect</i>.) \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is used). \throws Whatever <code>T::T(const T&)</code> throws. @@ -912,9 +909,9 @@ //! Create an empty <code>circular_buffer</code> with the specified capacity. /*! + \post <code>capacity() == capacity \&\& size() == 0</code> \param capacity The maximum number of elements which can be stored in the <code>circular_buffer</code>. \param alloc The allocator. - \post <code>capacity() == capacity \&\& size() == 0</code> \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is used). \par Complexity @@ -927,8 +924,8 @@ /*! \brief Create a full <code>circular_buffer</code> with the specified capacity and filled with <code>n</code> copies of <code>item</code>. - \post <code>capacity() == n \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item \&\& ... \&\& - (*this) [n - 1] == item </code> + \post <code>capacity() == n \&\& full() \&\& (*this)[0] == item \&\& (*this)[1] == item \&\& ... \&\& + (*this)[n - 1] == item </code> \param n The number of elements the created <code>circular_buffer</code> will be filled with. \param item The element the created <code>circular_buffer</code> will be filled with. \param alloc The allocator. @@ -988,7 +985,7 @@ BOOST_CATCH_END } -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) /*! \cond */ template <class InputIterator> @@ -1006,14 +1003,13 @@ #else - //! Create a <code>circular_buffer</code> filled with a copy of the range. + //! Create a full <code>circular_buffer</code> filled with a copy of the range. /*! \pre Valid range <code>[first, last)</code>.<br> <code>first</code> and <code>last</code> have to meet the requirements of <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. - \post <code>capacity() == std::distance(first, last) \&\& size() == std::distance(first, last) \&\& - (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ... \&\& (*this)[std::distance(first, last) - 1] - == *(last - 1)</code> + \post <code>capacity() == std::distance(first, last) \&\& full() \&\& (*this)[0]== *first \&\& + (*this)[1] == *(first + 1) \&\& ... \&\& (*this)[std::distance(first, last) - 1] == *(last - 1)</code> \param first The beginning of the range to be copied. \param last The end of the range to be copied. \param alloc The allocator. @@ -1057,7 +1053,7 @@ initialize(capacity, first, last, is_integral<InputIterator>()); } -#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //! The destructor. /*! @@ -2149,7 +2145,7 @@ clear(); insert(begin(), first, last); } else { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) circular_buffer<value_type, allocator_type> tmp(new_capacity, m_alloc); tmp.insert(begin(), first, last); #else |
|
From: Jan G. <jan...@us...> - 2007-04-09 22:06:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2309/libs/circular_buffer/doc Modified Files: circular_buffer.html circular_buffer_space_optimized.html circular_buffer_space_optimized.xslt Log Message: circular_buffer: updated srcdoc and test cases Index: circular_buffer.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.html,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- circular_buffer.html 8 Apr 2007 22:10:24 -0000 1.63 +++ circular_buffer.html 9 Apr 2007 22:06:13 -0000 1.64 @@ -1000,6 +1000,16 @@ Create an empty <code>circular_buffer</code> with the specified capacity. <dl> <dt> + <b>Effect:</b> + </dt> + <dd> + <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == + capacity && <a href= + "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == 0</code> + </dd> + </dl> + <dl> + <dt> <b>Parameter(s):</b> </dt> <dd> @@ -1025,16 +1035,6 @@ </dl> <dl> <dt> - <b>Effect:</b> - </dt> - <dd> - <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == - capacity && <a href= - "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == 0</code> - </dd> - </dl> - <dl> - <dt> <b>Throws:</b> </dt> <dd> @@ -1069,9 +1069,9 @@ </dt> <dd> <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == n - && <a href="#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n - && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] - == item</code> + && <a href="#classboost_1_1circular__buffer_1fd0eef8ba91210d1575404b7e3e8207a">full()</a> + && (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] == + item</code> </dd> </dl> <dl> @@ -1294,7 +1294,7 @@ "#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>& alloc = allocator_type());</b></code><br> <br> - Create a <code>circular_buffer</code> filled with a copy of the range. + Create a full <code>circular_buffer</code> filled with a copy of the range. <dl> <dt> <b>Precondition:</b> @@ -1312,9 +1312,9 @@ <dd> <code><a href="#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> == std::distance(first, last) && <a href= - "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == std::distance(first, - last) && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... && - (*this)[std::distance(first, last) - 1] == *(last - 1)</code> + "#classboost_1_1circular__buffer_1fd0eef8ba91210d1575404b7e3e8207a">full()</a> && (*this)[0]== + *first && (*this)[1] == *(first + 1) && ... && (*this)[std::distance(first, + last) - 1] == *(last - 1)</code> </dd> </dl> <dl> @@ -3670,7 +3670,7 @@ </dt> <dd> The element the <code>circular_buffer</code> will be filled with in order to gain the requested - size. (See the postcondition.) + size. (See the <i>Effect</i>.) </dd> </dl> </dd> @@ -6781,7 +6781,7 @@ <p> <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br> (See accompanying file <code>LICENSE_1_0.txt</code> or copy at <a href= - "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>.)</small> + "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</small> </p> </td> <td valign="top" align="right"> Index: circular_buffer_space_optimized.xslt =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.xslt,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- circular_buffer_space_optimized.xslt 8 Apr 2007 22:10:24 -0000 1.20 +++ circular_buffer_space_optimized.xslt 9 Apr 2007 22:06:14 -0000 1.21 @@ -23,7 +23,7 @@ <xsl:variable name="standalone-functions" select="document(concat($xmldir, '/namespaceboost.xml'))/doxygen/compounddef/sectiondef[@kind='func']"/> <xsl:template name="reference"> - <xsl:variable name="refid" select="$circular_buffer-reimplemented[@refid=current()/@refid]/../@id"/> + <xsl:variable name="refid" select="$circular_buffer-reimplemented[@refid=current()/@refid and text()!='capacity_type']/../@id"/> <xsl:value-of select="concat(substring(concat($link-prefix, '#', $refid), 1 div (string-length($refid) > 0)), substring(concat('#', @refid), 1 div (string-length($refid) = 0)))"/> </xsl:template> @@ -71,30 +71,6 @@ <xsl:for-each select="$current[string-length(normalize-space(briefdescription)) > 0]"> <xsl:apply-templates select="." mode="synopsis"/> </xsl:for-each> - <!-- - <xsl:for-each select="$current | document($circular_buffer-file)/doxygen/compounddef[@id = $circular_buffer-ref and @kind = 'class']/sectiondef[@kind='public-func']/memberdef[type != '']"> - <xsl:variable name="briefdescription" select="normalize-space(briefdescription)"/> - <xsl:if test="string-length($briefdescription) > 0"> - <xsl:choose> - <xsl:when test="count($current[name=current()/name]) > 0 and count(param/type[ref='circular_buffer']) > 0"> - <xsl:apply-templates select="$current[name=current()/name]" mode="synopsis"> - <xsl:with-param name="link-prefix" select="$link-prefix"/> - <xsl:with-param name="link" select="@id"/> - </xsl:apply-templates> - </xsl:when> - <xsl:when test="count($current[name=current()/name]) > 0 and count(param/type[ref='circular_buffer_space_optimized']) > 0"/> - <xsl:when test="../../compoundname = 'boost::circular_buffer_space_optimized'"> - <xsl:apply-templates select="." mode="synopsis"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates select="." mode="synopsis"> - <xsl:with-param name="link-prefix" select="$link-prefix"/> - </xsl:apply-templates> - </xsl:otherwise> - </xsl:choose> - </xsl:if> - </xsl:for-each> - --> </xsl:template> <xsl:template name="standalone-functions"> Index: circular_buffer_space_optimized.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- circular_buffer_space_optimized.html 8 Apr 2007 22:10:24 -0000 1.37 +++ circular_buffer_space_optimized.html 9 Apr 2007 22:06:14 -0000 1.38 @@ -190,11 +190,11 @@ const capacity_type& <a href= "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity</a>() const; void <a href= -"#classboost_1_1circular__buffer__space__optimized_143fa35280fc3cad2a6510065a065d67c">set_capacity</a>(const capacity_type& new_capacity); +"#classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f">set_capacity</a>(const capacity_type& capacity_ctrl); void <a href= "#classboost_1_1circular__buffer__space__optimized_1f244ff5576b79f8d60e273c02d71c9f2">resize</a>(size_type new_size, const_reference item = value_type()); void <a href= -"#classboost_1_1circular__buffer__space__optimized_16e2c5d77ea32819fd28f8ff2d5ce888a">rset_capacity</a>(size_type new_capacity); +"#classboost_1_1circular__buffer__space__optimized_10f096c108ebde69ae83a9de41b3bea56">rset_capacity</a>(const capacity_type& capacity_ctrl); void <a href= [...1363 lines suppressed...] </tr> <tr> @@ -877,7 +1646,7 @@ <a id="classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf" name= "classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf"></a><code><b>void assign(<a href= - "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> + "#classboost_1_1circular__buffer__space__optimized_1e805212e7de49dcb60f2cad1ef304bb3">capacity_type</a> capacity_ctrl, <a href= "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n, <a href= @@ -907,7 +1676,7 @@ "classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b"></a> <code><b>template <class InputIterator><br> void assign(<a href= - "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> + "#classboost_1_1circular__buffer__space__optimized_1e805212e7de49dcb60f2cad1ef304bb3">capacity_type</a> capacity_ctrl, InputIterator first, InputIterator last);</b></code><br> <br> See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source |
|
From: Jan G. <jan...@us...> - 2007-04-09 22:06:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2309/libs/circular_buffer/test Modified Files: space_optimized_test.cpp Log Message: circular_buffer: updated srcdoc and test cases Index: space_optimized_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/space_optimized_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- space_optimized_test.cpp 8 Apr 2007 22:10:24 -0000 1.13 +++ space_optimized_test.cpp 9 Apr 2007 22:06:14 -0000 1.14 @@ -58,6 +58,104 @@ BOOST_CHECK(cb3.capacity().min_capacity() <= cb3.internal_capacity()); } +void some_constructor_tests() { + + cb_space_optimized cb1; + BOOST_CHECK(cb1.capacity() == cb1.max_size()); + BOOST_CHECK(cb1.capacity().min_capacity() == 0); + BOOST_CHECK(cb1.internal_capacity() == 0); + BOOST_CHECK(cb1.size() == 0); + + cb1.push_back(1); + cb1.push_back(2); + cb1.push_back(3); + + BOOST_CHECK(cb1.size() == 3); + BOOST_CHECK(cb1.capacity() == cb1.max_size()); + + cb_space_optimized cb2(cb1.begin(), cb1.end()); + + BOOST_CHECK(cb2.capacity() == 3); + BOOST_CHECK(cb2.capacity().min_capacity() == 0); + BOOST_CHECK(cb2.size() == 3); +} + +void shrink_to_fit() { + + cb_space_optimized cb(1000); + cb.push_back(1); + cb.push_back(2); + cb.push_back(3); + + BOOST_CHECK(cb.size() == 3); + BOOST_CHECK(cb.capacity() == 1000); + + size_t internal_capacity = cb.internal_capacity(); + cb_space_optimized(cb).swap(cb); + + BOOST_CHECK(cb.size() == 3); + BOOST_CHECK(cb.capacity() == 1000); + BOOST_CHECK(internal_capacity >= cb.internal_capacity()); +} + +void iterator_invalidation_test() { + +#if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) + + cb_space_optimized cb1(10, 1); + cb1.push_back(2); + cb1.push_back(3); + cb1.push_back(4); + cb_space_optimized::iterator it1 = cb1.end(); + cb_space_optimized::const_iterator it2 = cb1.begin(); + cb_space_optimized::iterator it3 = cb1.begin() + 6; + + cb1.set_capacity(10); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); + BOOST_CHECK(!it3.is_valid(&cb1)); + + it1 = cb1.end(); + it2 = cb1.begin(); + it3 = cb1.begin() + 6; + cb1.rset_capacity(10); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); + BOOST_CHECK(!it3.is_valid(&cb1)); + + it1 = cb1.end(); + it2 = cb1.begin(); + it3 = cb1.begin() + 6; + cb1.resize(10); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); + BOOST_CHECK(!it3.is_valid(&cb1)); + + it1 = cb1.end(); + it2 = cb1.begin(); + it3 = cb1.begin() + 6; + cb1.rresize(10); + BOOST_CHECK(it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); + BOOST_CHECK(!it3.is_valid(&cb1)); + + { + cb_space_optimized cb2(10, 1); + cb2.push_back(2); + cb2.push_back(3); + cb2.push_back(4); + it1 = cb2.end(); + it2 = cb2.begin(); + it3 = cb2.begin() + 6; + } + BOOST_CHECK(!it1.is_valid(&cb1)); + BOOST_CHECK(!it2.is_valid(&cb1)); + BOOST_CHECK(!it3.is_valid(&cb1)); + + +#endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) +} + // test main test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) { @@ -65,6 +163,9 @@ add_common_tests(tests); tests->add(BOOST_TEST_CASE(&min_capacity_test)); + tests->add(BOOST_TEST_CASE(&some_constructor_tests)); + tests->add(BOOST_TEST_CASE(&shrink_to_fit)); + tests->add(BOOST_TEST_CASE(&iterator_invalidation_test)); return tests; } |
|
From: Steven W. <ste...@us...> - 2007-04-09 18:35:02
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14952/boost-sandbox/boost/units/detail Modified Files: conversion_impl.hpp Log Message: Removed extra square in static_int_power_impl Index: conversion_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/conversion_impl.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- conversion_impl.hpp 9 Apr 2007 18:01:19 -0000 1.4 +++ conversion_impl.hpp 9 Apr 2007 18:35:01 -0000 1.5 @@ -167,6 +167,16 @@ }; template<> +struct static_int_power_impl<1, false> +{ + template<class Y, class R> + static Y apply(const Y& y, const R& r) + { + return(y * r); + } +}; + +template<> struct static_int_power_impl<0, true> { template<class Y, class R> |
|
From: Steven W. <ste...@us...> - 2007-04-09 18:01:27
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1888/boost-sandbox/boost/units/detail Modified Files: conversion_impl.hpp Log Message: Fixed dimensionless problems Index: conversion_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/conversion_impl.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- conversion_impl.hpp 29 Mar 2007 16:55:50 -0000 1.3 +++ conversion_impl.hpp 9 Apr 2007 18:01:19 -0000 1.4 @@ -493,7 +493,7 @@ //one->many template<int N> -struct quantity_conversion_hetero_to_hetero_homo_to_hetero_impl_impl +struct fundamental_dimension_convert_homo_to_hetero_impl { template<class Begin, class Tag, class system1_type> struct apply @@ -506,7 +506,7 @@ typedef base_unit_converter<Tag, system1_type, system2_type> converter; - typedef typename quantity_conversion_hetero_to_hetero_homo_to_hetero_impl_impl<N - 1>::template + typedef typename fundamental_dimension_convert_homo_to_hetero_impl<N - 1>::template apply<next, Tag, system1_type> next_iteration; typedef typename multiply_typeof_helper<typename converter::type, @@ -520,7 +520,7 @@ }; template<> -struct quantity_conversion_hetero_to_hetero_homo_to_hetero_impl_impl<0> +struct fundamental_dimension_convert_homo_to_hetero_impl<0> { template<class Begin, class Tag, class system1_type> struct apply @@ -535,7 +535,7 @@ //many->one template<int N> -struct quantity_conversion_hetero_to_hetero_hetero_to_homo_impl_impl +struct fundamental_dimension_convert_hetero_to_homo_impl { template<class Begin, class Tag, class system2_type> struct apply @@ -548,7 +548,7 @@ typedef base_unit_converter<Tag, system1_type, system2_type> converter; - typedef typename quantity_conversion_hetero_to_hetero_hetero_to_homo_impl_impl<N - 1>::template + typedef typename fundamental_dimension_convert_hetero_to_homo_impl<N - 1>::template apply<next, Tag, system2_type> next_iteration; typedef typename multiply_typeof_helper<typename converter::type, @@ -565,7 +565,7 @@ }; template<> -struct quantity_conversion_hetero_to_hetero_hetero_to_homo_impl_impl<0> +struct fundamental_dimension_convert_hetero_to_homo_impl<0> { template<class Begin, class Tag, class system2_type> struct apply @@ -587,7 +587,7 @@ template<class Dim1, class Dim2> struct apply { - typedef typename quantity_conversion_hetero_to_hetero_homo_to_hetero_impl_impl<N2>::template apply< + typedef typename fundamental_dimension_convert_homo_to_hetero_impl<N2>::template apply< typename mpl::begin<typename Dim2::value_type>::type, typename Dim1::tag_type, typename mpl::front<typename Dim1::value_type>::type::tag_type @@ -600,7 +600,7 @@ template<class Dim1, class Dim2> struct apply { - typedef typename quantity_conversion_hetero_to_hetero_hetero_to_homo_impl_impl<N1>::template apply< + typedef typename fundamental_dimension_convert_hetero_to_homo_impl<N1>::template apply< typename mpl::begin<typename Dim1::value_type>::type, typename Dim1::tag_type, typename mpl::front<typename Dim2::value_type>::type::tag_type @@ -625,12 +625,17 @@ }; }; -template<int N> -struct quantity_conversion_hetero_to_hetero_impl -{ - template<class Begin1, class Begin2> - struct apply - { +template<int N1, int N2> +struct quantity_conversion_hetero_to_hetero_impl; + +template<bool less, bool greater> +struct quantity_conversion_hetero_to_hetero_impl_compare_test; + +// both systems contain this dimension +template<> +struct quantity_conversion_hetero_to_hetero_impl_compare_test<false, false> { + template<class Begin1, class Begin2, int N1, int N2> + struct apply { typedef homogeneous_system<typename detail::get_tag<typename mpl::deref<Begin1>::type>::type> dim_type; typedef typename detail::get_value<typename mpl::deref<Begin1>::type>::type value_type1; @@ -644,7 +649,7 @@ mpl::size<value_type2>::value >::template apply<typename mpl::deref<Begin1>::type,typename mpl::deref<Begin2>::type>::type converter; - typedef typename quantity_conversion_hetero_to_hetero_impl<N - 1>::template apply<next1, next2> next_iteration; + typedef typename quantity_conversion_hetero_to_hetero_impl<N2 - 1, N2 - 1>::template apply<next1, next2> next_iteration; typedef typename multiply_typeof_helper<typename converter::type, typename next_iteration::type>::type type; @@ -659,8 +664,112 @@ }; }; +// only the source contains the current fundamental dimension template<> -struct quantity_conversion_hetero_to_hetero_impl<0> +struct quantity_conversion_hetero_to_hetero_impl_compare_test<true, false> { + template<class Begin1, class Begin2, int N1, int N2> + struct apply { + typedef typename detail::get_tag<typename mpl::deref<Begin1>::type>::type dim_type; + + typedef typename detail::get_value<typename mpl::deref<Begin1>::type>::type value_type1; + + // we are going to arbitrarily decide to convert everything to the + // system with the lowest ordinal + typedef typename get_tag<typename mpl::front<value_type1>::type>::type result_system_type; + + typedef typename mpl::next<Begin1>::type next1; + typedef Begin2 next2; + + typedef typename fundamental_dimension_convert_hetero_to_homo_impl< + mpl::size<value_type1>::value + >::template apply<typename mpl::begin<value_type1>::type,dim_type,result_system_type> converter; + + typedef typename quantity_conversion_hetero_to_hetero_impl<N1 - 1, N2>::template apply<next1, next2> next_iteration; + + typedef typename multiply_typeof_helper<typename converter::type, + typename next_iteration::type>::type type; + + static type value() + { + return( + converter::value() * + next_iteration::value() + ); + } + }; +}; + +// only the destination contains the current fundamental dimension +template<> +struct quantity_conversion_hetero_to_hetero_impl_compare_test<false, true> { + template<class Begin1, class Begin2, int N1, int N2> + struct apply { + typedef typename detail::get_tag<typename mpl::deref<Begin2>::type>::type dim_type; + + typedef typename detail::get_value<typename mpl::deref<Begin2>::type>::type value_type2; + + // we are going to arbitrarily decide to convert everything to the + // system with the lowest ordinal + typedef typename get_tag<typename mpl::front<value_type2>::type>::type source_system_type; + + typedef Begin1 next1; + typedef typename mpl::next<Begin2>::type next2; + + typedef typename fundamental_dimension_convert_homo_to_hetero_impl< + mpl::size<value_type2>::value + >::template apply<typename mpl::begin<value_type2>::type,dim_type,source_system_type> converter; + + typedef typename quantity_conversion_hetero_to_hetero_impl<N1, N2 - 1>::template apply<next1, next2> next_iteration; + + typedef typename multiply_typeof_helper<typename converter::type, + typename next_iteration::type>::type type; + + static type value() + { + return( + converter::value() * + next_iteration::value() + ); + } + }; +}; + +template<int N1, int N2> +struct quantity_conversion_hetero_to_hetero_impl +{ + template<class Begin1, class Begin2> + struct apply : + quantity_conversion_hetero_to_hetero_impl_compare_test< + less<typename mpl::deref<Begin1>::type, typename mpl::deref<Begin2>::type>::value, + less<typename mpl::deref<Begin2>::type, typename mpl::deref<Begin1>::type>::value + >::template apply<Begin1, Begin2, N1, N2> + {}; +}; + +template<int N2> +struct quantity_conversion_hetero_to_hetero_impl<0, N2> +{ + template<class Begin1, class Begin2> + struct apply : + quantity_conversion_hetero_to_hetero_impl_compare_test< + false, true + >::template apply<Begin1, Begin2, 0, N2> + {}; +}; + +template<int N1> +struct quantity_conversion_hetero_to_hetero_impl<N1, 0> +{ + template<class Begin1, class Begin2> + struct apply : + quantity_conversion_hetero_to_hetero_impl_compare_test< + true, false + >::template apply<Begin1, Begin2, N1, 0> + {}; +}; + +template<> +struct quantity_conversion_hetero_to_hetero_impl<0, 0> { template<class Begin1, class Begin2> struct apply @@ -678,7 +787,13 @@ { typedef typename sort_heterogeneous_system_by_dimension_tag<System1>::type S1; typedef typename sort_heterogeneous_system_by_dimension_tag<System2>::type S2; - typedef typename quantity_conversion_hetero_to_hetero_impl<mpl::size<S1>::value>::template apply<typename mpl::begin<S1>::type, typename mpl::begin<S2>::type> converter; + typedef typename quantity_conversion_hetero_to_hetero_impl< + mpl::size<S1>::value, + mpl::size<S2>::value + >::template apply< + typename mpl::begin<S1>::type, + typename mpl::begin<S2>::type + > converter; typedef typename converter::type type; static type value() { |
|
From: Steven W. <ste...@us...> - 2007-04-09 17:59:29
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv998/boost-sandbox/libs/units/test Modified Files: test_conversion.cpp Log Message: More complete testing of heterogeneous, dimensionless conversions Index: test_conversion.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_conversion.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test_conversion.cpp 9 Apr 2007 16:53:00 -0000 1.4 +++ test_conversion.cpp 9 Apr 2007 17:59:26 -0000 1.5 @@ -31,6 +31,8 @@ #include <boost/test/minimal.hpp> +#define BOOST_UNITS_CHECK_CLOSE(a, b) (BOOST_CHECK((std::abs((a) - (b)) < .0000001))) + namespace bu = boost::units; typedef bu::SI::length si_length; @@ -95,9 +97,20 @@ - bu::quantity<bu::SI::dimensionless> dimensionless_test(1.0*bu::CGS::dyne/bu::SI::newton); - BOOST_CHECK(dimensionless_test == 1e-5); + bu::quantity<bu::SI::dimensionless> dimensionless_test1(1.0*bu::CGS::dyne/bu::SI::newton); + BOOST_CHECK(dimensionless_test1 == 1e-5); + + typedef bu::multiply_typeof_helper<bu::SI::length, bu::CGS::length>::type m_cm; + typedef bu::divide_typeof_helper<m_cm, m_cm>::type heterogeneous_dimensionless; + bu::quantity<heterogeneous_dimensionless> dimensionless_test2(1.0*bu::CGS::dyne/bu::SI::newton); + BOOST_CHECK(dimensionless_test2.value() == 1e-5); + bu::quantity<bu::divide_typeof_helper<bu::CGS::force, bu::SI::force>::type> dimensionless_test3(dimensionless_test2); + BOOST_UNITS_CHECK_CLOSE(dimensionless_test3.value(), 1.0); + + //m/cm -> g/kg + bu::quantity<bu::divide_typeof_helper<bu::SI::length, bu::CGS::length>::type> dimensionless_test4(2.0 * bu::SI::meters / bu::CGS::centimeters); + bu::quantity<bu::divide_typeof_helper<bu::CGS::mass, bu::SI::mass>::type> dimensionless_test5(dimensionless_test4); + BOOST_UNITS_CHECK_CLOSE(dimensionless_test5.value(), 2e5); return(0); } - |
|
From: Steven W. <ste...@us...> - 2007-04-09 16:53:31
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9855/boost-sandbox/libs/units/test Modified Files: test_conversion.cpp Log Message: Added test for simple heterogeneous, dimensionless conversions Index: test_conversion.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_conversion.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- test_conversion.cpp 3 Apr 2007 20:48:07 -0000 1.3 +++ test_conversion.cpp 9 Apr 2007 16:53:00 -0000 1.4 @@ -93,6 +93,11 @@ //quantity<SI::force> F6 = 20 * CGS::dyne; + + + bu::quantity<bu::SI::dimensionless> dimensionless_test(1.0*bu::CGS::dyne/bu::SI::newton); + BOOST_CHECK(dimensionless_test == 1e-5); + return(0); } |
|
From: Steven W. <ste...@us...> - 2007-04-09 16:50:54
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9038/boost-sandbox/boost/units Modified Files: quantity.hpp Log Message: Fixed dimensionless conversions Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- quantity.hpp 4 Apr 2007 23:04:08 -0000 1.14 +++ quantity.hpp 9 Apr 2007 16:50:41 -0000 1.15 @@ -188,14 +188,21 @@ } /// implicit conversion between different unit systems is allowed - template<class System2> - quantity(const quantity<unit<dimensionless_type,System2>,Y>& source) : + template<class System2, class Y2> + quantity(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y2>& source) : val_(source.value()) { } + /// conversion between different unit systems is explicit when + /// the units are not equivalent. + template<class System2, class Y2> + explicit quantity(const quantity<unit<dimensionless_type,System2>,Y2>& source) : + val_(conversion_helper<quantity<unit<dimensionless_type,System2>,Y2>, this_type>::convert(source).value()) + { } + /// implicit assignment between different unit systems is allowed template<class System2> - this_type& operator=(const quantity<unit<dimensionless_type,System2>,Y>& source) + this_type& operator=(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y>& source) { *this = this_type(source); |
|
From: Jan G. <jan...@us...> - 2007-04-08 22:11:14
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16205/boost/circular_buffer Modified Files: base.hpp debug.hpp details.hpp space_optimized.hpp Log Message: updated srcdoc Index: space_optimized.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/space_optimized.hpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- space_optimized.hpp 18 Feb 2007 23:03:26 -0000 1.24 +++ space_optimized.hpp 8 Apr 2007 22:10:24 -0000 1.25 @@ -1,6 +1,6 @@ // Implementation of the circular buffer adaptor. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -32,7 +32,7 @@ std::allocator<T> \author Jan Gaspar \version 1.4 - \date 2006 + \date 2007 For detailed documentation of the space_optimized_circular_buffer visit: http://www.boost.org/libs/circular_buffer/doc/circular_buffer_adaptor.html Index: debug.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/debug.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- debug.hpp 6 Mar 2007 00:03:46 -0000 1.11 +++ debug.hpp 8 Apr 2007 22:10:24 -0000 1.12 @@ -1,6 +1,6 @@ // Debug support for the circular buffer library. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: details.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/details.hpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- details.hpp 6 Mar 2007 00:03:46 -0000 1.24 +++ details.hpp 8 Apr 2007 22:10:24 -0000 1.25 @@ -1,6 +1,6 @@ // Helper classes and functions for the circular buffer. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.82 retrieving revision 1.83 diff -u -d -r1.82 -r1.83 --- base.hpp 6 Mar 2007 00:03:46 -0000 1.82 +++ base.hpp 8 Apr 2007 22:10:24 -0000 1.83 @@ -1,6 +1,6 @@ // Implementation of the base circular buffer. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -54,16 +54,18 @@ std::allocator<T> \author Jan Gaspar \version 3.7 [...1022 lines suppressed...] - \par Complexity - Linear (in the size of the <code>circular_buffer</code>). \par Exception Safety No-throw. \par Iterator Invalidation Invalidates all iterators pointing to the <code>circular_buffer</code>. + \par Complexity + Linear (in the size of the <code>circular_buffer</code>). \sa <code>~circular_buffer()</code>, <code>erase(iterator)</code>, <code>erase(iterator, iterator)</code>, <code>rerase(iterator)</code>, <code>rerase(iterator, iterator)</code> */ @@ -2117,7 +2154,7 @@ tmp.insert(begin(), first, last); #else circular_buffer<value_type, allocator_type> tmp(new_capacity, first, last, m_alloc); -#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#endif tmp.swap(*this); } } |
|
From: Jan G. <jan...@us...> - 2007-04-08 22:10:30
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16205/boost Modified Files: circular_buffer.hpp circular_buffer_fwd.hpp Log Message: updated srcdoc Index: circular_buffer.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- circular_buffer.hpp 13 Feb 2006 01:01:14 -0000 1.10 +++ circular_buffer.hpp 8 Apr 2007 22:10:23 -0000 1.11 @@ -1,6 +1,6 @@ // Circular buffer library header file. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: circular_buffer_fwd.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer_fwd.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- circular_buffer_fwd.hpp 13 Feb 2006 01:01:15 -0000 1.3 +++ circular_buffer_fwd.hpp 8 Apr 2007 22:10:23 -0000 1.4 @@ -1,6 +1,6 @@ // Forward declaration of the circular buffer and its adaptor. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16205/libs/circular_buffer/test Modified Files: base_test.cpp bounded_buffer_comparison.cpp common.ipp soft_iterator_invalidation.cpp space_optimized_test.cpp test.hpp Log Message: updated srcdoc Index: common.ipp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/common.ipp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- common.ipp 25 Mar 2007 22:55:24 -0000 1.15 +++ common.ipp 8 Apr 2007 22:10:24 -0000 1.16 @@ -1,6 +1,6 @@ // Common tests for the circular buffer and its adaptor. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -330,6 +330,7 @@ cb6.pop_back(); BOOST_CHECK(*cb1.linearize() == 4); + BOOST_CHECK(cb1.linearize() == cb1.array_one().first); BOOST_CHECK(&cb1[0] < &cb1[1] && &cb1[1] < &cb1[2] && &cb1[2] < &cb1[3] @@ -412,45 +413,115 @@ generic_test(cb6); } -void array_test() { - - CB_CONTAINER<MyInteger> cb(10); - const CB_CONTAINER<MyInteger> ccb(10, 1); +void array_range_test() { - CB_CONTAINER<MyInteger>::array_range ar1 = cb.array_one(); - CB_CONTAINER<MyInteger>::array_range ar2 = cb.array_two(); - CB_CONTAINER<MyInteger>::const_array_range car1 = ccb.array_one(); - CB_CONTAINER<MyInteger>::const_array_range car2 = ccb.array_two(); + CB_CONTAINER<MyInteger> cb(7); + CB_CONTAINER<MyInteger>::array_range a1 = cb.array_one(); + CB_CONTAINER<MyInteger>::array_range a2 = cb.array_two(); + CB_CONTAINER<MyInteger>::const_array_range ca1 = cb.array_one(); + CB_CONTAINER<MyInteger>::const_array_range ca2 = cb.array_two(); - BOOST_CHECK(ar1.second == 0); - BOOST_CHECK(ar2.second == 0); - BOOST_CHECK(car1.second == 10); - BOOST_CHECK(*(car1.first) == 1); - BOOST_CHECK(car2.second == 0); + BOOST_CHECK(a1.second == 0); + BOOST_CHECK(a2.second == 0); + BOOST_CHECK(ca1.second == 0); + BOOST_CHECK(ca2.second == 0); - cb.insert(cb.begin(), 10, 2); - ar1 = cb.array_one(); - ar2 = cb.array_two(); + cb.push_back(1); + cb.push_back(2); + cb.push_back(3); + a1 = cb.array_one(); + a2 = cb.array_two(); + ca1 = cb.array_one(); + ca2 = cb.array_two(); - BOOST_CHECK(ar1.second == 10); - BOOST_CHECK(ar2.second == 0); - BOOST_CHECK(*(ar1.first) == 2); - BOOST_CHECK(*(ar1.first + 9) == 2); + BOOST_CHECK(a1.first[0] == 1); + BOOST_CHECK(a1.first[2] == 3); + BOOST_CHECK(ca1.first[0] == 1); + BOOST_CHECK(ca1.first[2] == 3); + BOOST_CHECK(a1.second == 3); + BOOST_CHECK(a2.second == 0); + BOOST_CHECK(ca1.second == 3); + BOOST_CHECK(ca2.second == 0); - cb.push_back(3); cb.push_back(4); cb.push_back(5); + cb.push_back(6); + cb.push_back(7); + cb.push_back(8); + cb.push_back(9); + cb.push_back(10); + a1 = cb.array_one(); + a2 = cb.array_two(); + ca1 = cb.array_one(); + ca2 = cb.array_two(); + + BOOST_CHECK(a1.first[0] == 4); + BOOST_CHECK(a1.first[3] == 7); + BOOST_CHECK(a2.first[0] == 8); + BOOST_CHECK(a2.first[2] == 10); + BOOST_CHECK(ca1.first[0] == 4); + BOOST_CHECK(ca1.first[3] == 7); + BOOST_CHECK(ca2.first[0] == 8); + BOOST_CHECK(ca2.first[2] == 10); + BOOST_CHECK(a1.second == 4); + BOOST_CHECK(a2.second == 3); + BOOST_CHECK(ca1.second == 4); + BOOST_CHECK(ca2.second == 3); + + cb.pop_front(); cb.pop_back(); - ar1 = cb.array_one(); - ar2 = cb.array_two(); + a1 = cb.array_one(); + a2 = cb.array_two(); + ca1 = cb.array_one(); + ca2 = cb.array_two(); - BOOST_CHECK(ar1.second == 7); - BOOST_CHECK(ar2.second == 2); - BOOST_CHECK(*(ar1.first) == 2); - BOOST_CHECK(*(ar2.first) == 3); - BOOST_CHECK(*(ar2.first + 1) == 4); + BOOST_CHECK(a1.first[0] == 5); + BOOST_CHECK(a1.first[2] == 7); + BOOST_CHECK(a2.first[0] == 8); + BOOST_CHECK(a2.first[1] == 9); + BOOST_CHECK(ca1.first[0] == 5); + BOOST_CHECK(ca1.first[2] == 7); + BOOST_CHECK(ca2.first[0] == 8); + BOOST_CHECK(ca2.first[1] == 9); + BOOST_CHECK(a1.second == 3); + BOOST_CHECK(a2.second == 2); + BOOST_CHECK(ca1.second == 3); + BOOST_CHECK(ca2.second == 2); + + cb.pop_back(); + cb.pop_back(); + cb.pop_back(); + a1 = cb.array_one(); + a2 = cb.array_two(); + ca1 = cb.array_one(); + ca2 = cb.array_two(); + + BOOST_CHECK(a1.first[0] == 5); + BOOST_CHECK(a1.first[1] == 6); + BOOST_CHECK(ca1.first[0] == 5); + BOOST_CHECK(ca1.first[1] == 6); + BOOST_CHECK(a1.second == 2); + BOOST_CHECK(a2.second == 0); + BOOST_CHECK(ca1.second == 2); + BOOST_CHECK(ca2.second == 0); + + CB_CONTAINER<MyInteger> cb0(0); + a1 = cb0.array_one(); + a2 = cb0.array_two(); + + BOOST_CHECK(a1.second == 0); + BOOST_CHECK(a2.second == 0); + + const CB_CONTAINER<MyInteger> ccb(10, 1); + ca1 = ccb.array_one(); + ca2 = ccb.array_two(); + + BOOST_CHECK(ca1.second == 10); + BOOST_CHECK(*(ca1.first) == 1); + BOOST_CHECK(ca2.second == 0); generic_test(cb); + generic_test(cb0); } void capacity_and_reserve_test() { @@ -555,7 +626,6 @@ BOOST_CHECK(cb3.size() == 0); BOOST_CHECK(cb3.capacity() == 0); - generic_test(cb1); generic_test(cb2); generic_test(cb3); @@ -735,6 +805,16 @@ BOOST_CHECK(cb5[5] == 6); BOOST_CHECK(cb5.size() == 6); +#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + + CB_CONTAINER<int> cb6(MyInputIterator(v.begin()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb7(3, MyInputIterator(v.begin()), MyInputIterator(v.end())); + + BOOST_CHECK(cb6.capacity() == 5); + BOOST_CHECK(cb7.capacity() == 3); + +#endif // #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + generic_test(cb1); generic_test(cb2); generic_test(cb3); @@ -776,6 +856,25 @@ BOOST_CHECK(cb3.size() == 10); BOOST_CHECK(cb3.capacity() == 10); +#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + + vector<int> v; + v.push_back(1); + v.push_back(2); + v.push_back(3); + v.push_back(4); + v.push_back(5); + + CB_CONTAINER<int> cb4(3); + cb4.assign(MyInputIterator(v.begin()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb5(3); + cb5.assign(4, MyInputIterator(v.begin()), MyInputIterator(v.end())); + + BOOST_CHECK(cb4.capacity() == 5); + BOOST_CHECK(cb5.capacity() == 4); + +#endif // #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + generic_test(cb1); generic_test(cb3); } @@ -992,6 +1091,72 @@ BOOST_CHECK(cb5[4] == 3); BOOST_CHECK(cb5[5] == 4); +#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + + v.clear(); + v.push_back(1); + v.push_back(2); + v.push_back(3); + v.push_back(4); + v.push_back(5); + + CB_CONTAINER<int> cb6(4); + cb6.push_back(0); + cb6.push_back(-1); + cb6.push_back(-2); + cb6.insert(cb6.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); + v.clear(); + v.push_back(11); + v.push_back(12); + v.push_back(13); + CB_CONTAINER<int> cb7(4); + cb7.push_back(1); + cb7.push_back(2); + cb7.push_back(3); + cb7.insert(cb7.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb8(2, 2); + cb8.insert(cb8.end(), MyInputIterator(v.begin()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb9(5); + cb9.insert(cb9.end(), MyInputIterator(v.end()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb10(5); + cb10.insert(cb10.end(), MyInputIterator(v.begin()), MyInputIterator(v.begin() + 1)); + v.clear(); + v.push_back(5); + v.push_back(6); + v.push_back(7); + v.push_back(8); + v.push_back(9); + CB_CONTAINER<int> cb11(6); + cb11.push_back(1); + cb11.push_back(2); + cb11.push_back(3); + cb11.push_back(4); + cb11.insert(cb11.begin() + 2, MyInputIterator(v.begin()), MyInputIterator(v.begin() + 5)); + cb11.insert(cb11.begin(), MyInputIterator(v.begin()), MyInputIterator(v.begin() + 5)); + + BOOST_CHECK(cb6.capacity() == 4); + BOOST_CHECK(cb6[0] == 4); + BOOST_CHECK(cb6[3] == -2); + BOOST_CHECK(cb7.full()); + BOOST_CHECK(cb7[0] == 12); + BOOST_CHECK(cb7[1] == 13); + BOOST_CHECK(cb7[2] == 2); + BOOST_CHECK(cb7[3] == 3); + BOOST_CHECK(cb8[0] == 12); + BOOST_CHECK(cb8[1] == 13); + BOOST_CHECK(cb9.empty()); + BOOST_CHECK(cb10[0] == 11); + BOOST_CHECK(cb10.size() == 1); + BOOST_CHECK(cb11.size() == 6); + BOOST_CHECK(cb11[0] == 6); + BOOST_CHECK(cb11[1] == 7); + BOOST_CHECK(cb11[2] == 8); + BOOST_CHECK(cb11[3] == 9); + BOOST_CHECK(cb11[4] == 3); + BOOST_CHECK(cb11[5] == 4); + +#endif // #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + generic_test(cb1); generic_test(cb2); generic_test(cb3); @@ -1200,6 +1365,53 @@ BOOST_CHECK(cb4[0] == 11); BOOST_CHECK(cb4.size() == 1); +#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + + v.clear(); + v.push_back(1); + v.push_back(2); + v.push_back(3); + v.push_back(4); + v.push_back(5); + + CB_CONTAINER<int> cb10(4); + cb10.push_back(0); + cb10.push_back(-1); + cb10.push_back(-2); + cb10.rinsert(cb10.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); + v.clear(); + v.push_back(11); + v.push_back(12); + v.push_back(13); + v.push_back(14); + CB_CONTAINER<int> cb11(4); + cb11.push_back(1); + cb11.push_back(2); + cb11.push_back(3); + cb11.rinsert(cb11.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb12(2, 2); + cb12.rinsert(cb12.begin(), MyInputIterator(v.begin()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb13(5); + cb13.rinsert(cb13.begin(), MyInputIterator(v.end()), MyInputIterator(v.end())); + CB_CONTAINER<int> cb14(5); + cb14.rinsert(cb14.begin(), MyInputIterator(v.begin()), MyInputIterator(v.begin() + 1)); + + BOOST_CHECK(cb10.capacity() == 4); + BOOST_CHECK(cb10[0] == 0); + BOOST_CHECK(cb10[3] == 3); + BOOST_CHECK(cb11.full()); + BOOST_CHECK(cb11[0] == 1); + BOOST_CHECK(cb11[1] == 11); + BOOST_CHECK(cb11[2] == 12); + BOOST_CHECK(cb11[3] == 13); + BOOST_CHECK(cb12[0] == 11); + BOOST_CHECK(cb12[1] == 12); + BOOST_CHECK(cb13.empty()); + BOOST_CHECK(cb14[0] == 11); + BOOST_CHECK(cb14.size() == 1); + +#endif // #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + generic_test(cb1); generic_test(cb2); generic_test(cb3); @@ -1565,125 +1777,6 @@ BOOST_CHECK(cb.back() == 5); } -// TODO - split into sections: constructor, insert, assign ... -void input_range_test() { - -#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) - - vector<int> v; - v.push_back(1); - v.push_back(2); - v.push_back(3); - v.push_back(4); - v.push_back(5); - - CB_CONTAINER<int> cb1(MyInputIterator(v.begin()), MyInputIterator(v.end())); - - CB_CONTAINER<int> cb2(3, MyInputIterator(v.begin()), MyInputIterator(v.end())); - - CB_CONTAINER<int> cb3(3); - cb3.assign(MyInputIterator(v.begin()), MyInputIterator(v.end())); - - CB_CONTAINER<int> cb4(3); - cb4.assign(4, MyInputIterator(v.begin()), MyInputIterator(v.end())); - - CB_CONTAINER<int> cb5(4); - cb5.push_back(0); - cb5.push_back(-1); - cb5.push_back(-2); - cb5.insert(cb5.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); - - CB_CONTAINER<int> cb6(4); - cb6.push_back(0); - cb6.push_back(-1); - cb6.push_back(-2); - cb6.rinsert(cb6.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); - - BOOST_CHECK(cb1.capacity() == 5); - BOOST_CHECK(cb2.capacity() == 3); - BOOST_CHECK(cb3.capacity() == 5); - BOOST_CHECK(cb4.capacity() == 4); - BOOST_CHECK(cb5.capacity() == 4); - BOOST_CHECK(cb6.capacity() == 4); - - v.clear(); - v.push_back(11); - v.push_back(12); - v.push_back(13); - v.push_back(14); - CB_CONTAINER<int> cb11(4); - cb11.push_back(1); - cb11.push_back(2); - cb11.push_back(3); - cb11.rinsert(cb11.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); - CB_CONTAINER<int> cb12(2, 2); - cb12.rinsert(cb12.begin(), MyInputIterator(v.begin()), MyInputIterator(v.end())); - CB_CONTAINER<int> cb13(5); - cb13.rinsert(cb13.begin(), MyInputIterator(v.end()), MyInputIterator(v.end())); - CB_CONTAINER<int> cb14(5); - cb14.rinsert(cb14.begin(), MyInputIterator(v.begin()), MyInputIterator(v.begin() + 1)); - - BOOST_CHECK(cb11.full()); - BOOST_CHECK(cb11[0] == 1); - BOOST_CHECK(cb11[1] == 11); - BOOST_CHECK(cb11[2] == 12); - BOOST_CHECK(cb11[3] == 13); - BOOST_CHECK(cb12[0] == 11); - BOOST_CHECK(cb12[1] == 12); - BOOST_CHECK(cb13.empty()); - BOOST_CHECK(cb14[0] == 11); - BOOST_CHECK(cb14.size() == 1); - - v.clear(); - v.push_back(11); - v.push_back(12); - v.push_back(13); - CB_CONTAINER<int> cb21(4); - cb21.push_back(1); - cb21.push_back(2); - cb21.push_back(3); - cb21.insert(cb21.begin() + 1, MyInputIterator(v.begin()), MyInputIterator(v.end())); - CB_CONTAINER<int> cb22(2, 2); - cb22.insert(cb22.end(), MyInputIterator(v.begin()), MyInputIterator(v.end())); - CB_CONTAINER<int> cb23(5); - cb23.insert(cb23.end(), MyInputIterator(v.end()), MyInputIterator(v.end())); - CB_CONTAINER<int> cb24(5); - cb24.insert(cb24.end(), MyInputIterator(v.begin()), MyInputIterator(v.begin() + 1)); - v.clear(); - v.push_back(5); - v.push_back(6); - v.push_back(7); - v.push_back(8); - v.push_back(9); - CB_CONTAINER<int> cb25(6); - cb25.push_back(1); - cb25.push_back(2); - cb25.push_back(3); - cb25.push_back(4); - cb25.insert(cb25.begin() + 2, MyInputIterator(v.begin()), MyInputIterator(v.begin() + 5)); - cb25.insert(cb25.begin(), MyInputIterator(v.begin()), MyInputIterator(v.begin() + 5)); - - BOOST_CHECK(cb21.full()); - BOOST_CHECK(cb21[0] == 12); - BOOST_CHECK(cb21[1] == 13); - BOOST_CHECK(cb21[2] == 2); - BOOST_CHECK(cb21[3] == 3); - BOOST_CHECK(cb22[0] == 12); - BOOST_CHECK(cb22[1] == 13); - BOOST_CHECK(cb23.empty()); - BOOST_CHECK(cb24[0] == 11); - BOOST_CHECK(cb24.size() == 1); - BOOST_CHECK(cb25.size() == 6); - BOOST_CHECK(cb25[0] == 6); - BOOST_CHECK(cb25[1] == 7); - BOOST_CHECK(cb25[2] == 8); - BOOST_CHECK(cb25[3] == 9); - BOOST_CHECK(cb25[4] == 3); - BOOST_CHECK(cb25[5] == 4); - -#endif // #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) -} - int MyInteger::ms_exception_trigger = 0; int InstanceCounter::ms_count = 0; @@ -1699,7 +1792,7 @@ tests->add(BOOST_TEST_CASE(&at_test)); tests->add(BOOST_TEST_CASE(&front_and_back_test)); tests->add(BOOST_TEST_CASE(&linearize_test)); - tests->add(BOOST_TEST_CASE(&array_test)); + tests->add(BOOST_TEST_CASE(&array_range_test)); tests->add(BOOST_TEST_CASE(&capacity_and_reserve_test)); tests->add(BOOST_TEST_CASE(&full_and_empty_test)); tests->add(BOOST_TEST_CASE(&set_capacity_test)); @@ -1731,5 +1824,4 @@ tests->add(BOOST_TEST_CASE(&example_test)); tests->add(BOOST_TEST_CASE(&element_destruction_test)); tests->add(BOOST_TEST_CASE(&const_methods_test)); - tests->add(BOOST_TEST_CASE(&input_range_test)); } Index: bounded_buffer_comparison.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/bounded_buffer_comparison.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- bounded_buffer_comparison.cpp 8 Oct 2006 21:40:59 -0000 1.6 +++ bounded_buffer_comparison.cpp 8 Apr 2007 22:10:24 -0000 1.7 @@ -1,6 +1,6 @@ // Comparison of bounded buffers based on different containers. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: test.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/test.hpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- test.hpp 6 Mar 2007 00:03:46 -0000 1.14 +++ test.hpp 8 Apr 2007 22:10:24 -0000 1.15 @@ -1,6 +1,6 @@ // Header file for the test of the circular buffer library. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: space_optimized_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/space_optimized_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- space_optimized_test.cpp 6 Mar 2007 00:03:46 -0000 1.12 +++ space_optimized_test.cpp 8 Apr 2007 22:10:24 -0000 1.13 @@ -1,6 +1,6 @@ // Test of the space optimized adaptor of the circular buffer. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: base_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/base_test.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- base_test.cpp 26 Feb 2007 22:37:09 -0000 1.18 +++ base_test.cpp 8 Apr 2007 22:10:24 -0000 1.19 @@ -1,6 +1,6 @@ // Test of the base circular buffer container. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -189,7 +189,7 @@ BOOST_CHECK(!(end - 1 < it)); } -// TODO add insert, linearize etc. +// TODO add insert, push_back etc. void iterator_invalidation_test() { #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) @@ -327,6 +327,119 @@ BOOST_CHECK(!it4.is_valid(&cb6)); BOOST_CHECK(it2.is_valid(&cb6)); + circular_buffer<MyInteger> cb7(10, 1); + cb7.push_back(2); + cb7.push_back(3); + cb7.push_back(4); + it1 = cb7.end(); + it2 = cb7.begin(); + it3 = cb7.begin() + 6; + cb7.linearize(); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(!it2.is_valid(&cb7)); + BOOST_CHECK(!it3.is_valid(&cb7)); + it1 = cb7.end(); + it2 = cb7.begin(); + it3 = cb7.begin() + 6; + cb7.linearize(); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(it2.is_valid(&cb7)); + BOOST_CHECK(it3.is_valid(&cb7)); + + cb7.push_back(5); + cb7.push_back(6); + it1 = cb7.end(); + it2 = cb7.begin(); + it3 = cb7.begin() + 6; + cb7.set_capacity(10); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(it2.is_valid(&cb7)); + BOOST_CHECK(it3.is_valid(&cb7)); + cb7.set_capacity(20); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(!it2.is_valid(&cb7)); + BOOST_CHECK(!it3.is_valid(&cb7)); + cb7.push_back(7); + it1 = cb7.end(); + it2 = cb7.begin(); + it3 = cb7.begin() + 6; + cb7.set_capacity(10); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(!it2.is_valid(&cb7)); + BOOST_CHECK(!it3.is_valid(&cb7)); + + cb7.push_back(8); + cb7.push_back(9); + it1 = cb7.end(); + it2 = cb7.begin(); + it3 = cb7.begin() + 6; + cb7.rset_capacity(10); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(it2.is_valid(&cb7)); + BOOST_CHECK(it3.is_valid(&cb7)); + cb7.rset_capacity(20); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(!it2.is_valid(&cb7)); + BOOST_CHECK(!it3.is_valid(&cb7)); + cb7.push_back(10); + it1 = cb7.end(); + it2 = cb7.begin(); + it3 = cb7.begin() + 6; + cb7.rset_capacity(10); + BOOST_CHECK(it1.is_valid(&cb7)); + BOOST_CHECK(!it2.is_valid(&cb7)); + BOOST_CHECK(!it3.is_valid(&cb7)); + + circular_buffer<MyInteger> cb8(10, 1); + cb8.push_back(2); + cb8.push_back(3); + it1 = cb8.end(); + it2 = cb8.begin(); + it3 = cb8.begin() + 6; + cb8.resize(10); + BOOST_CHECK(it1.is_valid(&cb8)); + BOOST_CHECK(it2.is_valid(&cb8)); + BOOST_CHECK(it3.is_valid(&cb8)); + cb8.resize(20); + BOOST_CHECK(it1.is_valid(&cb8)); + BOOST_CHECK(!it2.is_valid(&cb8)); + BOOST_CHECK(!it3.is_valid(&cb8)); + cb8.push_back(4); + it1 = cb8.end(); + it2 = cb8.begin(); + it3 = cb8.begin() + 6; + it4 = cb8.begin() + 12; + cb8.resize(10); + BOOST_CHECK(it1.is_valid(&cb8)); + BOOST_CHECK(it2.is_valid(&cb8)); + BOOST_CHECK(it3.is_valid(&cb8)); + BOOST_CHECK(!it4.is_valid(&cb8)); + + cb8.set_capacity(10); + cb8.push_back(5); + cb8.push_back(6); + it1 = cb8.end(); + it2 = cb8.begin(); + it3 = cb8.begin() + 6; + cb8.rresize(10); + BOOST_CHECK(it1.is_valid(&cb8)); + BOOST_CHECK(it2.is_valid(&cb8)); + BOOST_CHECK(it3.is_valid(&cb8)); + cb8.rresize(20); + BOOST_CHECK(it1.is_valid(&cb8)); + BOOST_CHECK(!it2.is_valid(&cb8)); + BOOST_CHECK(!it3.is_valid(&cb8)); + cb8.push_back(7); + it1 = cb8.end(); + it2 = cb8.begin(); + it3 = cb8.begin() + 6; + it4 = cb8.begin() + 12; + cb8.rresize(10); + BOOST_CHECK(it1.is_valid(&cb8)); + BOOST_CHECK(!it2.is_valid(&cb8)); + BOOST_CHECK(!it3.is_valid(&cb8)); + BOOST_CHECK(it4.is_valid(&cb8)); + #endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) } @@ -338,6 +451,11 @@ circular_buffer<MyInteger> cb1(3, 5); MyInteger::set_exception_trigger(3); BOOST_CHECK_THROW(cb1.set_capacity(5), exception); + BOOST_CHECK(cb1.capacity() == 3); + MyInteger::set_exception_trigger(3); + BOOST_CHECK_THROW(cb1.rset_capacity(5), exception); + BOOST_CHECK(cb1.capacity() == 3); + generic_test(cb1); MyInteger::set_exception_trigger(3); BOOST_CHECK_THROW(circular_buffer<MyInteger> cb2(5, 10), exception); @@ -493,101 +611,6 @@ #endif // #if !defined(BOOST_NO_EXCEPTIONS) } -void array_range_test() { - - CB_CONTAINER<MyInteger> cb(7); - CB_CONTAINER<MyInteger>::array_range a1 = cb.array_one(); - CB_CONTAINER<MyInteger>::array_range a2 = cb.array_two(); - CB_CONTAINER<MyInteger>::const_array_range ca1 = cb.array_one(); - CB_CONTAINER<MyInteger>::const_array_range ca2 = cb.array_two(); - - BOOST_CHECK(a1.second == 0); - BOOST_CHECK(a2.second == 0); - BOOST_CHECK(ca1.second == 0); - BOOST_CHECK(ca2.second == 0); - - cb.push_back(1); - cb.push_back(2); - cb.push_back(3); - a1 = cb.array_one(); - a2 = cb.array_two(); - ca1 = cb.array_one(); - ca2 = cb.array_two(); - - BOOST_CHECK(a1.first[0] == 1); - BOOST_CHECK(a1.first[2] == 3); - BOOST_CHECK(ca1.first[0] == 1); - BOOST_CHECK(ca1.first[2] == 3); - BOOST_CHECK(a1.second == 3); - BOOST_CHECK(a2.second == 0); - BOOST_CHECK(ca1.second == 3); - BOOST_CHECK(ca2.second == 0); - - cb.push_back(4); - cb.push_back(5); - cb.push_back(6); - cb.push_back(7); - cb.push_back(8); - cb.push_back(9); - cb.push_back(10); - a1 = cb.array_one(); - a2 = cb.array_two(); - ca1 = cb.array_one(); - ca2 = cb.array_two(); - - BOOST_CHECK(a1.first[0] == 4); - BOOST_CHECK(a1.first[3] == 7); - BOOST_CHECK(a2.first[0] == 8); - BOOST_CHECK(a2.first[2] == 10); - BOOST_CHECK(ca1.first[0] == 4); - BOOST_CHECK(ca1.first[3] == 7); - BOOST_CHECK(ca2.first[0] == 8); - BOOST_CHECK(ca2.first[2] == 10); - BOOST_CHECK(a1.second == 4); - BOOST_CHECK(a2.second == 3); - BOOST_CHECK(ca1.second == 4); - BOOST_CHECK(ca2.second == 3); - - cb.pop_front(); - cb.pop_back(); - a1 = cb.array_one(); - a2 = cb.array_two(); - ca1 = cb.array_one(); - ca2 = cb.array_two(); - - BOOST_CHECK(a1.first[0] == 5); - BOOST_CHECK(a1.first[2] == 7); - BOOST_CHECK(a2.first[0] == 8); - BOOST_CHECK(a2.first[1] == 9); - BOOST_CHECK(ca1.first[0] == 5); - BOOST_CHECK(ca1.first[2] == 7); - BOOST_CHECK(ca2.first[0] == 8); - BOOST_CHECK(ca2.first[1] == 9); - BOOST_CHECK(a1.second == 3); - BOOST_CHECK(a2.second == 2); - BOOST_CHECK(ca1.second == 3); - BOOST_CHECK(ca2.second == 2); - - cb.pop_back(); - cb.pop_back(); - cb.pop_back(); - a1 = cb.array_one(); - a2 = cb.array_two(); - ca1 = cb.array_one(); - ca2 = cb.array_two(); - - BOOST_CHECK(a1.first[0] == 5); - BOOST_CHECK(a1.first[1] == 6); - BOOST_CHECK(ca1.first[0] == 5); - BOOST_CHECK(ca1.first[1] == 6); - BOOST_CHECK(a1.second == 2); - BOOST_CHECK(a2.second == 0); - BOOST_CHECK(ca1.second == 2); - BOOST_CHECK(ca2.second == 0); - - generic_test(cb); -} - // test main test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) { @@ -605,7 +628,6 @@ tests->add(BOOST_TEST_CASE(&iterator_comparison_test)); tests->add(BOOST_TEST_CASE(&iterator_invalidation_test)); tests->add(BOOST_TEST_CASE(&exception_safety_test)); - tests->add(BOOST_TEST_CASE(&array_range_test)); return tests; } Index: soft_iterator_invalidation.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/soft_iterator_invalidation.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- soft_iterator_invalidation.cpp 18 Dec 2006 01:30:29 -0000 1.3 +++ soft_iterator_invalidation.cpp 8 Apr 2007 22:10:24 -0000 1.4 @@ -3,7 +3,7 @@ // Note: The soft iterator invalidation definition can not be applied // to the space optimized circular buffer. -// Copyright (c) 2003-2006 Jan Gaspar +// Copyright (c) 2003-2007 Jan Gaspar // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
|
From: Jan G. <jan...@us...> - 2007-04-08 22:10:27
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16205/libs/circular_buffer/doc Modified Files: HOWTO-srcdoc circular_buffer.html circular_buffer.xslt circular_buffer_space_optimized.html circular_buffer_space_optimized.xslt copy.xslt doxygen2html.xslt html2xhtml.xslt update_srcdoc.sh update_srcdoc.xslt Log Message: updated srcdoc Index: circular_buffer.xslt =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.xslt,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- circular_buffer.xslt 2 Oct 2006 23:30:20 -0000 1.14 +++ circular_buffer.xslt 8 Apr 2007 22:10:24 -0000 1.15 @@ -3,7 +3,7 @@ XSL transformation from the XML files generated by Doxygen into XHTML source code documentation of the circular_buffer. -Copyright (c) 2006 Jan Gaspar +Copyright (c) 2007 Jan Gaspar Use, modification, and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: doxygen2html.xslt =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/doxygen2html.xslt,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- doxygen2html.xslt 23 Jan 2007 23:12:35 -0000 1.41 +++ doxygen2html.xslt 8 Apr 2007 22:10:24 -0000 1.42 @@ -3,7 +3,7 @@ Generic XSL transformation from the XML files generated by Doxygen into XHTML source code documentation. -Copyright (c) 2006 Jan Gaspar +Copyright (c) 2007 Jan Gaspar Use, modification, and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -41,6 +41,10 @@ <b><xsl:apply-templates/></b> </xsl:template> + <xsl:template match="emphasis"> + <i><xsl:apply-templates/></i> + </xsl:template> + <xsl:template match="linebreak"> <br /> </xsl:template> @@ -103,6 +107,10 @@ <dd><xsl:apply-templates select="parameterdescription"/></dd> </dl> </xsl:when> + <xsl:when test="contains(parameternamelist/parametername, '<code>')"> + <code><xsl:value-of select="substring-before(substring-after(parameternamelist/parametername, '<code>'), '</code>')"/></code> + <xsl:apply-templates select="parameterdescription"/> + </xsl:when> <xsl:otherwise> <xsl:apply-templates select="parameternamelist/parametername"/> <xsl:apply-templates select="parameterdescription"/> Index: HOWTO-srcdoc =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/HOWTO-srcdoc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- HOWTO-srcdoc 8 Oct 2006 22:01:09 -0000 1.3 +++ HOWTO-srcdoc 8 Apr 2007 22:10:24 -0000 1.4 @@ -2,7 +2,7 @@ # HOW-TO documentation about generating/updating source code documentation for # # the Circular Buffer library. # # # -# Copyright (c) 2006 Jan Gaspar # +# Copyright (c) 2007 Jan Gaspar # # # # Use, modification, and distribution is subject to the Boost Software # # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # Index: copy.xslt =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/copy.xslt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- copy.xslt 19 Aug 2006 15:37:09 -0000 1.4 +++ copy.xslt 8 Apr 2007 22:10:24 -0000 1.5 @@ -2,7 +2,7 @@ <!-- Helper XSL transformation making plain copy of an XML tree. -Copyright (c) 2006 Jan Gaspar +Copyright (c) 2007 Jan Gaspar Use, modification, and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: circular_buffer_space_optimized.xslt =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.xslt,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- circular_buffer_space_optimized.xslt 2 Oct 2006 23:30:20 -0000 1.19 +++ circular_buffer_space_optimized.xslt 8 Apr 2007 22:10:24 -0000 1.20 @@ -3,7 +3,7 @@ XSL transformation from the XML files generated by Doxygen into XHTML source code documentation of the circular_buffer_space_optimized. -Copyright (c) 2006 Jan Gaspar +Copyright (c) 2007 Jan Gaspar Use, modification, and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: circular_buffer.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.html,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- circular_buffer.html 26 Feb 2007 22:37:09 -0000 1.62 +++ circular_buffer.html 8 Apr 2007 22:10:24 -0000 1.63 @@ -983,7 +983,7 @@ </dt> <dd> This constructor has been defined only due to compatibility with the STL container definition. Avoid - using it because it allocates very large amount of memory. + using it because it may allocate very large amount of memory. </dd> </dl> </td> @@ -1499,26 +1499,19 @@ </dl> <dl> [...2162 lines suppressed...] <dl> <dt> - <b>Iterator Invalidation:</b> + <b>Complexity:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Linear (in the size of the <code>circular_buffer</code>). </dd> </dl> <dl> @@ -6595,7 +6776,7 @@ <tr valign="top"> <td valign="top" align="left"> <p> - <small>Copyright © 2003-2006 Jan Gaspar</small> + <small>Copyright © 2003-2007 Jan Gaspar</small> </p> <p> <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br> Index: circular_buffer_space_optimized.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- circular_buffer_space_optimized.html 18 Feb 2007 23:03:27 -0000 1.36 +++ circular_buffer_space_optimized.html 8 Apr 2007 22:10:24 -0000 1.37 @@ -1333,7 +1333,7 @@ <tr> <td align="left" valign="top"> <p> - <small>Copyright © 2003-2006 Jan Gaspar</small> + <small>Copyright © 2003-2007 Jan Gaspar</small> </p> <p> <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br> Index: update_srcdoc.sh =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/update_srcdoc.sh,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- update_srcdoc.sh 8 Oct 2006 21:59:11 -0000 1.8 +++ update_srcdoc.sh 8 Apr 2007 22:10:24 -0000 1.9 @@ -3,7 +3,7 @@ # Shell script which updates the Circular Buffer library documentation with # # the latest source code documentation (which is in the source files). # # # -# Copyright (c) 2006 Jan Gaspar # +# Copyright (c) 2007 Jan Gaspar # # # # Use, modification, and distribution is subject to the Boost Software # # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # Index: html2xhtml.xslt =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/html2xhtml.xslt,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- html2xhtml.xslt 19 Aug 2006 15:37:09 -0000 1.6 +++ html2xhtml.xslt 8 Apr 2007 22:10:24 -0000 1.7 @@ -2,7 +2,7 @@ <!-- Helper XSL transformation which converts HTML into XHTML. -Copyright (c) 2006 Jan Gaspar +Copyright (c) 2007 Jan Gaspar Use, modification, and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Index: update_srcdoc.xslt =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/update_srcdoc.xslt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- update_srcdoc.xslt 19 Aug 2006 15:37:09 -0000 1.4 +++ update_srcdoc.xslt 8 Apr 2007 22:10:24 -0000 1.5 @@ -3,7 +3,7 @@ Helper XSL transformation updating source code documentation sections in the specified HTML file. -Copyright (c) 2006 Jan Gaspar +Copyright (c) 2007 Jan Gaspar Use, modification, and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
|
From: Matthias S. <mat...@us...> - 2007-04-06 20:57:46
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26627/si Added Files: action.hpp Log Message: add unit of action --- NEW FILE: action.hpp --- // 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) #ifndef BOOST_UNITS_SI_ACTION_HPP #define BOOST_UNITS_SI_ACTION_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<action_type,SI::system> action; } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_ACTION_HPP |
|
From: Matthias S. <mat...@us...> - 2007-04-06 20:57:46
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26627 Modified Files: physical_units.hpp Log Message: add unit of action Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- physical_units.hpp 5 Apr 2007 21:08:54 -0000 1.12 +++ physical_units.hpp 6 Apr 2007 20:57:45 -0000 1.13 @@ -111,6 +111,9 @@ /// composite dimension for acceleration : L T^-2 typedef derived_dimension<length_tag,1,time_tag,-2>::type acceleration_type; +/// composite dimension for action : L^2 M T^-1 +typedef derived_dimension<length_tag,2,mass_tag,1,time_tag,-1>::type action_type; + /// composite dimension for activity : T^-1 typedef derived_dimension<time_tag,-1>::type activity_type; |
|
From: Matthias S. <mat...@us...> - 2007-04-05 22:42:07
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27305 Modified Files: conversion.hpp Log Message: conversion_factor will give wrong results for irregular conversions Index: conversion.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/conversion.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- conversion.hpp 5 Apr 2007 21:55:20 -0000 1.4 +++ conversion.hpp 5 Apr 2007 22:42:01 -0000 1.5 @@ -149,6 +149,7 @@ Y conversion_factor(const FromUnit&,const ToUnit&) { + // dangerous if conversion is not regular...don't know how to deal with this yet return quantity<ToUnit,Y>(Y(1)*FromUnit()).value(); }; |
|
From: Matthias S. <mat...@us...> - 2007-04-05 21:56:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30903/example Modified Files: unit_example_22.cpp unit_example_4.cpp Log Message: remove boost/units/measurement.hpp, move to libs/units/example test conversion_factor<> function Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- unit_example_22.cpp 5 Apr 2007 21:09:34 -0000 1.12 +++ unit_example_22.cpp 5 Apr 2007 21:56:15 -0000 1.13 @@ -419,6 +419,10 @@ #include <boost/units/quantity.hpp> #include <boost/units/systems/si/force.hpp> #include <boost/units/systems/cgs/force.hpp> +#include <boost/units/systems/si/mass.hpp> +#include <boost/units/systems/cgs/mass.hpp> +#include <boost/units/systems/si/momentum.hpp> +#include <boost/units/systems/cgs/momentum.hpp> int main() { @@ -426,7 +430,11 @@ using namespace boost::units; std::cout << quantity<SI::dimensionless>(1.0*CGS::dyne/SI::newton) << std::endl; - std::cout << conversion_factor<CGS::dyne,SI::newton,double>() << std::endl; + std::cout << exp(quantity<SI::dimensionless>(1.0*(SI::newtons*CGS::dynes)/(SI::newtons*CGS::dynes))) << std::endl; + std::cout << conversion_factor<double>(CGS::dyne,SI::newton) << std::endl; + std::cout << conversion_factor<double>(SI::newton/SI::kilogram,CGS::dyne/CGS::gram) << std::endl; + std::cout << conversion_factor<double>(CGS::momentum(),SI::momentum()) << std::endl; + std::cout << conversion_factor<double>(SI::momentum()/SI::mass(),CGS::momentum()/CGS::mass()) << 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.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- unit_example_4.cpp 4 Apr 2007 20:06:57 -0000 1.8 +++ unit_example_4.cpp 5 Apr 2007 21:56:15 -0000 1.9 @@ -141,12 +141,13 @@ #include <algorithm> #include <sstream> -#include <boost/units/measurement.hpp> #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" + namespace boost { namespace units { |
|
From: Matthias S. <mat...@us...> - 2007-04-05 21:55:23
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30398 Modified Files: conversion.hpp Log Message: implement conversion_factor function Index: conversion.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/conversion.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- conversion.hpp 5 Apr 2007 21:08:54 -0000 1.3 +++ conversion.hpp 5 Apr 2007 21:55:20 -0000 1.4 @@ -144,10 +144,10 @@ } }; -template<class FromUnit,class ToUnit,class Y> -inline +template<class Y,class FromUnit,class ToUnit> +inline Y -conversion_factor() +conversion_factor(const FromUnit&,const ToUnit&) { return quantity<ToUnit,Y>(Y(1)*FromUnit()).value(); }; |
|
From: Matthias S. <mat...@us...> - 2007-04-05 21:09:35
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32336/example Modified Files: unit_example_15.cpp unit_example_22.cpp Added Files: measurement.hpp Log Message: add measurement.hpp Index: unit_example_15.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_15.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- unit_example_15.cpp 4 Apr 2007 21:18:42 -0000 1.3 +++ unit_example_15.cpp 5 Apr 2007 21:09:34 -0000 1.4 @@ -46,10 +46,10 @@ struct system { }; /// unit typedefs -typedef unit<system,dimensionless_type> dimensionless; +typedef unit<dimensionless_type,system> dimensionless; -typedef unit<system,world_space_type> world_space_unit; -typedef unit<system,object_space_type> object_space_unit; +typedef unit<world_space_type,system> world_space_unit; +typedef unit<object_space_type,system> object_space_unit; static const world_space_unit world_space; static const object_space_unit object_space; --- NEW FILE: measurement.hpp --- // 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) #ifndef BOOST_UNITS_MEASUREMENT_HPP #define BOOST_UNITS_MEASUREMENT_HPP #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <boost/io/ios_state.hpp> #include <boost/numeric/interval.hpp> #include <boost/units/static_rational.hpp> namespace boost { namespace units { namespace sqr_namespace { template<class Y> Y sqr(Y val) { return val*val; } } // namespace using sqr_namespace::sqr; template<class Y> class measurement { public: typedef measurement<Y> this_type; typedef Y value_type; typedef numeric::interval<value_type> interval_type; measurement(const value_type& val = value_type(), const value_type& err = value_type()) : value_(val), uncertainty_(std::abs(err)) { } measurement(const this_type& source) : value_(source.value_), uncertainty_(source.uncertainty_) { } //~measurement() { } this_type& operator=(const this_type& source) { if (this == &source) return *this; value_ = source.value_; uncertainty_ = source.uncertainty_; return *this; } operator value_type() const { return value_; } value_type value() const { return value_; } value_type uncertainty() const { return uncertainty_; } value_type lower_bound() const { return value_-uncertainty_; } value_type upper_bound() const { return value_+uncertainty_; } interval_type get_interval() const { return interval_type(lower_bound(),upper_bound()); } this_type& operator+=(const value_type& val) { value_ += val; return *this; } this_type& operator-=(const value_type& val) { value_ -= val; return *this; } this_type& operator*=(const value_type& val) { value_ *= val; uncertainty_ *= val; return *this; } this_type& operator/=(const value_type& val) { value_ /= val; uncertainty_ /= val; return *this; } this_type& operator+=(const this_type& /*source*/); this_type& operator-=(const this_type& /*source*/); this_type& operator*=(const this_type& /*source*/); this_type& operator/=(const this_type& /*source*/); private: value_type value_, uncertainty_; }; } } #if BOOST_UNITS_HAS_BOOST_TYPEOF BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::measurement, 1) #endif namespace boost { namespace units { template<class Y> inline measurement<Y>& measurement<Y>::operator+=(const this_type& source) { uncertainty_ = std::sqrt(sqr(uncertainty_)+sqr(source.uncertainty_)); value_ += source.value_; return *this; } template<class Y> inline measurement<Y>& measurement<Y>::operator-=(const this_type& source) { uncertainty_ = std::sqrt(sqr(uncertainty_)+sqr(source.uncertainty_)); value_ -= source.value_; return *this; } template<class Y> inline measurement<Y>& measurement<Y>::operator*=(const this_type& source) { uncertainty_ = (value_*source.value_)* std::sqrt(sqr(uncertainty_/value_)+ sqr(source.uncertainty_/source.value_)); value_ *= source.value_; return *this; } template<class Y> inline measurement<Y>& measurement<Y>::operator/=(const this_type& source) { uncertainty_ = (value_/source.value_)* std::sqrt(sqr(uncertainty_/value_)+ sqr(source.uncertainty_/source.value_)); value_ /= source.value_; return *this; } // value_type op measurement template<class Y> inline measurement<Y> operator+(Y lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs,Y(0))+=rhs); } template<class Y> inline measurement<Y> operator-(Y lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs,Y(0))-=rhs); } template<class Y> inline measurement<Y> operator*(Y lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs,Y(0))*=rhs); } template<class Y> inline measurement<Y> operator/(Y lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs,Y(0))/=rhs); } // measurement op value_type template<class Y> inline measurement<Y> operator+(const measurement<Y>& lhs,Y rhs) { return (measurement<Y>(lhs)+=measurement<Y>(rhs,Y(0))); } template<class Y> inline measurement<Y> operator-(const measurement<Y>& lhs,Y rhs) { return (measurement<Y>(lhs)-=measurement<Y>(rhs,Y(0))); } template<class Y> inline measurement<Y> operator*(const measurement<Y>& lhs,Y rhs) { return (measurement<Y>(lhs)*=measurement<Y>(rhs,Y(0))); } template<class Y> inline measurement<Y> operator/(const measurement<Y>& lhs,Y rhs) { return (measurement<Y>(lhs)/=measurement<Y>(rhs,Y(0))); } // measurement op measurement template<class Y> inline measurement<Y> operator+(const measurement<Y>& lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs)+=rhs); } template<class Y> inline measurement<Y> operator-(const measurement<Y>& lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs)-=rhs); } template<class Y> inline measurement<Y> operator*(const measurement<Y>& lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs)*=rhs); } template<class Y> inline measurement<Y> operator/(const measurement<Y>& lhs,const measurement<Y>& rhs) { return (measurement<Y>(lhs)/=rhs); } /// specialize power typeof helper template<class Y,long N,long D> struct power_typeof_helper<measurement<Y>,static_rational<N,D> > { typedef measurement<typename power_typeof_helper<Y,static_rational<N,D> >::type> type; static type value(const measurement<Y>& x) { const static_rational<N,D> rat; const Y m = Y(rat.numerator())/Y(rat.denominator()), newval = std::pow(x.value(),m), err = newval*std::sqrt(std::pow(m*x.uncertainty()/x.value(),2)); return type(newval,err); } }; /// specialize root typeof helper template<class Y,long N,long D> struct root_typeof_helper<measurement<Y>,static_rational<N,D> > { typedef measurement<typename root_typeof_helper<Y,static_rational<N,D> >::type> type; static type value(const measurement<Y>& x) { const static_rational<N,D> rat; const Y m = Y(rat.denominator())/Y(rat.numerator()), newval = std::pow(x.value(),m), err = newval*std::sqrt(std::pow(m*x.uncertainty()/x.value(),2)); return type(newval,err); } }; // stream output template<class Y> inline std::ostream& operator<<(std::ostream& os,const measurement<Y>& val) { boost::io::ios_precision_saver precision_saver(os); boost::io::ios_width_saver width_saver(os); boost::io::ios_flags_saver flags_saver(os); os << std::setw(21); if (val.uncertainty() > Y(0)) { const Y relative_uncertainty = std::abs(val.uncertainty()/val.value()); const double exponent = std::log10(relative_uncertainty); const long digits_of_precision = static_cast<long>(std::ceil(std::abs(exponent)))+3; // should try to replicate NIST CODATA syntax os << std::setprecision(digits_of_precision) //<< std::setw(digits_of_precision+8) //<< std::scientific << val.value(); // << long(10*(relative_uncertainty/std::pow(Y(10),Y(exponent)))); os << " (rel. unc. = " << std::setprecision(1) << std::setw(7) << std::scientific << relative_uncertainty << ")"; } else { os << val.value() << " (exact)"; } return os; } } // namespace units } // namespace boost #endif // BOOST_UNITS_MEASUREMENT_HPP Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- unit_example_22.cpp 5 Apr 2007 03:05:44 -0000 1.11 +++ unit_example_22.cpp 5 Apr 2007 21:09:34 -0000 1.12 @@ -426,6 +426,7 @@ using namespace boost::units; std::cout << quantity<SI::dimensionless>(1.0*CGS::dyne/SI::newton) << std::endl; + std::cout << conversion_factor<CGS::dyne,SI::newton,double>() << std::endl; return 0; } |
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31276/systems/si/codata Modified Files: atomic_and_nuclear_constants.hpp electromagnetic_constants.hpp physico-chemical_constants.hpp universal_constants.hpp Log Message: remove measurement.hpp Index: universal_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/universal_constants.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- universal_constants.hpp 3 Apr 2007 23:14:00 -0000 1.4 +++ universal_constants.hpp 5 Apr 2007 21:08:54 -0000 1.5 @@ -13,10 +13,9 @@ #if BOOST_UNITS_HAS_TYPEOF -#include <boost/units/measurement.hpp> #include <boost/units/static_constant.hpp> -//#include <boost/units/systems/si.hpp> +#include <boost/units/systems/si/constants.hpp> #include <boost/units/systems/si/capacitance.hpp> #include <boost/units/systems/si/current.hpp> #include <boost/units/systems/si/energy.hpp> @@ -46,27 +45,27 @@ // UNIVERSAL /// speed of light -BOOST_UNITS_AUTO_STATIC_CONSTANT(c,(measurement<double>(299792458.0,0.0)*meters/second)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(c,(value_and_uncertainty<double>(299792458.0,0.0)*meters/second)); /// magnetic constant (exactly 4 pi x 10^(-7) - error is due to finite precision of pi) -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_0,(measurement<double>(12.56637061435917295385057353311801153679e-7,0.0)*newtons/ampere/ampere)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_0,(value_and_uncertainty<double>(12.56637061435917295385057353311801153679e-7,0.0)*newtons/ampere/ampere)); /// electric constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(epsilon_0,(measurement<double>(8.854187817620389850536563031710750260608e-12,0.0)*farad/meter)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(epsilon_0,(value_and_uncertainty<double>(8.854187817620389850536563031710750260608e-12,0.0)*farad/meter)); /// characteristic impedance of vacuum -BOOST_UNITS_AUTO_STATIC_CONSTANT(Z_0,(measurement<double>(376.7303134617706554681984004203193082686,0.0)*ohm)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(Z_0,(value_and_uncertainty<double>(376.7303134617706554681984004203193082686,0.0)*ohm)); /// Newtonian constant of gravitation -BOOST_UNITS_AUTO_STATIC_CONSTANT(G,(measurement<double>(6.67428e-11,6.7e-15)*cubic_meters/kilogram/second/second)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(G,(value_and_uncertainty<double>(6.67428e-11,6.7e-15)*cubic_meters/kilogram/second/second)); /// Planck constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(h,(measurement<double>(6.62606896e-34,3.3e-41)*joule*seconds)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(h,(value_and_uncertainty<double>(6.62606896e-34,3.3e-41)*joule*seconds)); /// Dirac constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(hbar,(measurement<double>(1.054571628e-34,5.3e-42)*joule*seconds)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(hbar,(value_and_uncertainty<double>(1.054571628e-34,5.3e-42)*joule*seconds)); /// Planck mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_P,(measurement<double>(2.17644e-8,1.1e-12)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_P,(value_and_uncertainty<double>(2.17644e-8,1.1e-12)*kilograms)); /// Planck temperature -BOOST_UNITS_AUTO_STATIC_CONSTANT(T_P,(measurement<double>(1.416785e32,7.1e27)*kelvin)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(T_P,(value_and_uncertainty<double>(1.416785e32,7.1e27)*kelvin)); /// Planck length -BOOST_UNITS_AUTO_STATIC_CONSTANT(l_P,(measurement<double>(1.616252e-35,8.1e-40)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(l_P,(value_and_uncertainty<double>(1.616252e-35,8.1e-40)*meters)); /// Planck time -BOOST_UNITS_AUTO_STATIC_CONSTANT(t_P,(measurement<double>(5.39124e-44,2.7e-48)*seconds)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(t_P,(value_and_uncertainty<double>(5.39124e-44,2.7e-48)*seconds)); } // namespace CODATA Index: physico-chemical_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/physico-chemical_constants.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- physico-chemical_constants.hpp 3 Apr 2007 23:14:00 -0000 1.5 +++ physico-chemical_constants.hpp 5 Apr 2007 21:08:54 -0000 1.6 @@ -13,10 +13,9 @@ #if BOOST_UNITS_HAS_TYPEOF -#include <boost/units/measurement.hpp> #include <boost/units/static_constant.hpp> -//#include <boost/units/systems/si.hpp> +#include <boost/units/systems/si/constants.hpp> #include <boost/units/systems/si/amount.hpp> #include <boost/units/systems/si/area.hpp> #include <boost/units/systems/si/electric_charge.hpp> @@ -43,27 +42,27 @@ // PHYSICO-CHEMICAL /// Avogadro constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(N_A,(measurement<double>(6.02214179e23,3.0e16)/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(N_A,(value_and_uncertainty<double>(6.02214179e23,3.0e16)/mole)); /// atomic mass constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_u,(measurement<double>(1.660538782e-27,8.3e-35)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_u,(value_and_uncertainty<double>(1.660538782e-27,8.3e-35)*kilograms)); /// Faraday constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(F,(measurement<double>(96485.3399,2.4e-3)*coulombs/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(F,(value_and_uncertainty<double>(96485.3399,2.4e-3)*coulombs/mole)); /// molar gas constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(R,(measurement<double>(8.314472,1.5e-5)*joules/kelvin/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(R,(value_and_uncertainty<double>(8.314472,1.5e-5)*joules/kelvin/mole)); /// Boltzmann constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(k_B,(measurement<double>(1.3806504e-23,2.4e-29)*joules/kelvin)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(k_B,(value_and_uncertainty<double>(1.3806504e-23,2.4e-29)*joules/kelvin)); /// Stefan-Boltzmann constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_SB,(measurement<double>(5.670400e-8,4.0e-13)*watts/square_meter/pow<4>(kelvin))); +BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_SB,(value_and_uncertainty<double>(5.670400e-8,4.0e-13)*watts/square_meter/pow<4>(kelvin))); /// first radiation constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(c_1,(measurement<double>(3.74177118e-16,1.9e-23)*watt*square_meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(c_1,(value_and_uncertainty<double>(3.74177118e-16,1.9e-23)*watt*square_meters)); /// first radiation constant for spectral radiance -BOOST_UNITS_AUTO_STATIC_CONSTANT(c_1L,(measurement<double>(1.191042759e-16,5.9e-24)*watt*square_meters/steradian)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(c_1L,(value_and_uncertainty<double>(1.191042759e-16,5.9e-24)*watt*square_meters/steradian)); /// second radiation constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(c_2,(measurement<double>(1.4387752e-2,2.5e-8)*meter*kelvin)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(c_2,(value_and_uncertainty<double>(1.4387752e-2,2.5e-8)*meter*kelvin)); /// Wien displacement law constant : lambda_max T -BOOST_UNITS_AUTO_STATIC_CONSTANT(b,(measurement<double>(2.8977685e-3,5.1e-9)*meter*kelvin)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(b,(value_and_uncertainty<double>(2.8977685e-3,5.1e-9)*meter*kelvin)); /// Wien displacement law constant : nu_max/T -BOOST_UNITS_AUTO_STATIC_CONSTANT(b_prime,(measurement<double>(5.878933e10,1.0e15)*hertz/kelvin)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(b_prime,(value_and_uncertainty<double>(5.878933e10,1.0e15)*hertz/kelvin)); } // namespace CODATA Index: atomic_and_nuclear_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/atomic_and_nuclear_constants.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- atomic_and_nuclear_constants.hpp 3 Apr 2007 23:14:00 -0000 1.6 +++ atomic_and_nuclear_constants.hpp 5 Apr 2007 21:08:54 -0000 1.7 @@ -13,10 +13,9 @@ #if BOOST_UNITS_HAS_TYPEOF -#include <boost/units/measurement.hpp> #include <boost/units/static_constant.hpp> -//#include <boost/units/systems/si.hpp> +#include <boost/units/systems/si/constants.hpp> #include <boost/units/systems/si/amount.hpp> #include <boost/units/systems/si/area.hpp> #include <boost/units/systems/si/electric_charge.hpp> @@ -44,250 +43,250 @@ // ATOMIC AND NUCLEAR /// fine structure constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(alpha,(measurement<double>(7.2973525376e-3,5.0e-12)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(alpha,(value_and_uncertainty<double>(7.2973525376e-3,5.0e-12)*dimensionless())); /// Rydberg constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_infinity,(measurement<double>(10973731.568527,7.3e-5)/meter)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(R_infinity,(value_and_uncertainty<double>(10973731.568527,7.3e-5)/meter)); /// Bohr radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(a_0,(measurement<double>(0.52917720859e-10,3.6e-20)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(a_0,(value_and_uncertainty<double>(0.52917720859e-10,3.6e-20)*meters)); /// Hartree energy -BOOST_UNITS_AUTO_STATIC_CONSTANT(E_h,(measurement<double>(4.35974394e-18,2.2e-25)*joules)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(E_h,(value_and_uncertainty<double>(4.35974394e-18,2.2e-25)*joules)); /// electron mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e,(measurement<double>(9.10938215e-31,4.5e-38)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e,(value_and_uncertainty<double>(9.10938215e-31,4.5e-38)*kilograms)); /// electron-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_mu,(measurement<double>(4.83633171e-3,1.2e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_mu,(value_and_uncertainty<double>(4.83633171e-3,1.2e-10)*dimensionless())); /// electron-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_tau,(measurement<double>(2.87564e-4,4.7e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_tau,(value_and_uncertainty<double>(2.87564e-4,4.7e-8)*dimensionless())); /// electron-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_p,(measurement<double>(5.4461702177e-4,2.4e-13)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_p,(value_and_uncertainty<double>(5.4461702177e-4,2.4e-13)*dimensionless())); /// electron-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_n,(measurement<double>(5.4386734459e-4,3.3e-13)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_n,(value_and_uncertainty<double>(5.4386734459e-4,3.3e-13)*dimensionless())); /// electron-deuteron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_d,(measurement<double>(2.7244371093e-4,1.2e-13)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_d,(value_and_uncertainty<double>(2.7244371093e-4,1.2e-13)*dimensionless())); /// electron-alpha particle mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_alpha,(measurement<double>(1.37093355570e-4,5.8e-14)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_alpha,(value_and_uncertainty<double>(1.37093355570e-4,5.8e-14)*dimensionless())); /// electron charge to mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_m_e,(measurement<double>(1.758820150e11,4.4e3)*coulombs/kilogram)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_m_e,(value_and_uncertainty<double>(1.758820150e11,4.4e3)*coulombs/kilogram)); /// electron molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_e,(measurement<double>(5.4857990943e-7,2.3e-16)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_e,(value_and_uncertainty<double>(5.4857990943e-7,2.3e-16)*kilograms/mole)); /// Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C,(measurement<double>(2.4263102175e-12,3.3e-21)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C,(value_and_uncertainty<double>(2.4263102175e-12,3.3e-21)*meters)); /// classical electron radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(r_e,(measurement<double>(2.8179402894e-15,5.8e-24)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(r_e,(value_and_uncertainty<double>(2.8179402894e-15,5.8e-24)*meters)); /// Thompson cross section -BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_e,(measurement<double>(0.6652458558e-28,2.7e-37)*square_meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_e,(value_and_uncertainty<double>(0.6652458558e-28,2.7e-37)*square_meters)); /// electron magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e,(measurement<double>(-928.476377e-26,2.3e-31)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e,(value_and_uncertainty<double>(-928.476377e-26,2.3e-31)*joules/tesla)); /// electron-Bohr magenton moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_B,(measurement<double>(-1.00115965218111,7.4e-13)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_B,(value_and_uncertainty<double>(-1.00115965218111,7.4e-13)*dimensionless())); /// electron-nuclear magneton moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_N,(measurement<double>(-183.28197092,8.0e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_N,(value_and_uncertainty<double>(-183.28197092,8.0e-7)*dimensionless())); /// electron magnetic moment anomaly -BOOST_UNITS_AUTO_STATIC_CONSTANT(a_e,(measurement<double>(1.15965218111e-3,7.4e-13)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(a_e,(value_and_uncertainty<double>(1.15965218111e-3,7.4e-13)*dimensionless())); /// electron g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_e,(measurement<double>(-2.0023193043622,1.5e-12)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(g_e,(value_and_uncertainty<double>(-2.0023193043622,1.5e-12)*dimensionless())); /// electron-muon magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_mu,(measurement<double>(206.7669877,5.2e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_mu,(value_and_uncertainty<double>(206.7669877,5.2e-6)*dimensionless())); /// electron-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_p,(measurement<double>(-658.2106848,5.4e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_p,(value_and_uncertainty<double>(-658.2106848,5.4e-6)*dimensionless())); /// electron-shielded proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_p_prime,(measurement<double>(-658.2275971,7.2e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_p_prime,(value_and_uncertainty<double>(-658.2275971,7.2e-6)*dimensionless())); /// electron-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_n,(measurement<double>(960.92050,2.3e-4)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_n,(value_and_uncertainty<double>(960.92050,2.3e-4)*dimensionless())); /// electron-deuteron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_d,(measurement<double>(-2143.923498,1.8e-5)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_d,(value_and_uncertainty<double>(-2143.923498,1.8e-5)*dimensionless())); /// electron-shielded helion magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_h_prime,(measurement<double>(864.058257,1.0e-5)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_h_prime,(value_and_uncertainty<double>(864.058257,1.0e-5)*dimensionless())); /// electron gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_e,(measurement<double>(1.760859770e11,4.4e3)/second/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_e,(value_and_uncertainty<double>(1.760859770e11,4.4e3)/second/tesla)); /// muon mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu,(measurement<double>(1.88353130e-28,1.1e-35)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu,(value_and_uncertainty<double>(1.88353130e-28,1.1e-35)*kilograms)); /// muon-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_e,(measurement<double>(206.7682823,5.2e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_e,(value_and_uncertainty<double>(206.7682823,5.2e-6)*dimensionless())); /// muon-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_tau,(measurement<double>(5.94592e-2,9.7e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_tau,(value_and_uncertainty<double>(5.94592e-2,9.7e-6)*dimensionless())); /// muon-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_p,(measurement<double>(0.1126095261,2.9e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_p,(value_and_uncertainty<double>(0.1126095261,2.9e-9)*dimensionless())); /// muon-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_n,(measurement<double>(0.1124545167,2.9e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_n,(value_and_uncertainty<double>(0.1124545167,2.9e-9)*dimensionless())); /// muon molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_mu,(measurement<double>(0.1134289256e-3,2.9e-12)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_mu,(value_and_uncertainty<double>(0.1134289256e-3,2.9e-12)*kilograms/mole)); /// muon Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_mu,(measurement<double>(11.73444104e-15,3.0e-22)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_mu,(value_and_uncertainty<double>(11.73444104e-15,3.0e-22)*meters)); /// muon magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu,(measurement<double>(-4.49044786e-26,1.6e-33)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu,(value_and_uncertainty<double>(-4.49044786e-26,1.6e-33)*joules/tesla)); /// muon-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_B,(measurement<double>(-4.84197049e-3,1.2e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_B,(value_and_uncertainty<double>(-4.84197049e-3,1.2e-10)*dimensionless())); /// muon-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_N,(measurement<double>(-8.89059705,2.3e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_N,(value_and_uncertainty<double>(-8.89059705,2.3e-7)*dimensionless())); /// muon magnetic moment anomaly -BOOST_UNITS_AUTO_STATIC_CONSTANT(a_mu,(measurement<double>(1.16592069e-3,6.0e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(a_mu,(value_and_uncertainty<double>(1.16592069e-3,6.0e-10)*dimensionless())); /// muon g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_mu,(measurement<double>(-2.0023318414,1.2e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(g_mu,(value_and_uncertainty<double>(-2.0023318414,1.2e-9)*dimensionless())); /// muon-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_p,(measurement<double>(-3.183345137,8.5e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_p,(value_and_uncertainty<double>(-3.183345137,8.5e-8)*dimensionless())); /// tau mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau,(measurement<double>(3.16777e-27,5.2e-31)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau,(value_and_uncertainty<double>(3.16777e-27,5.2e-31)*kilograms)); /// tau-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_e,(measurement<double>(3477.48,5.7e-1)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_e,(value_and_uncertainty<double>(3477.48,5.7e-1)*dimensionless())); /// tau-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_mu,(measurement<double>(16.8183,2.7e-3)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_mu,(value_and_uncertainty<double>(16.8183,2.7e-3)*dimensionless())); /// tau-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_p,(measurement<double>(1.89390,3.1e-4)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_p,(value_and_uncertainty<double>(1.89390,3.1e-4)*dimensionless())); /// tau-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_n,(measurement<double>(1.89129,3.1e-4)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_n,(value_and_uncertainty<double>(1.89129,3.1e-4)*dimensionless())); /// tau molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_tau,(measurement<double>(1.90768e-3,3.1e-7)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_tau,(value_and_uncertainty<double>(1.90768e-3,3.1e-7)*kilograms/mole)); /// tau Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_tau,(measurement<double>(0.69772e-15,1.1e-19)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_tau,(value_and_uncertainty<double>(0.69772e-15,1.1e-19)*meters)); /// proton mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p,(measurement<double>(1.672621637e-27,8.3e-35)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p,(value_and_uncertainty<double>(1.672621637e-27,8.3e-35)*kilograms)); /// proton-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_e,(measurement<double>(1836.15267247,8.0e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_e,(value_and_uncertainty<double>(1836.15267247,8.0e-7)*dimensionless())); /// proton-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_mu,(measurement<double>(8.88024339,2.3e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_mu,(value_and_uncertainty<double>(8.88024339,2.3e-7)*dimensionless())); /// proton-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_tau,(measurement<double>(0.528012,8.6e-5)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_tau,(value_and_uncertainty<double>(0.528012,8.6e-5)*dimensionless())); /// proton-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_n,(measurement<double>(0.99862347824,4.6e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_n,(value_and_uncertainty<double>(0.99862347824,4.6e-10)*dimensionless())); /// proton charge to mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_m_p,(measurement<double>(9.57883392e7,2.4e0)*coulombs/kilogram)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_m_p,(value_and_uncertainty<double>(9.57883392e7,2.4e0)*coulombs/kilogram)); /// proton molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_p,(measurement<double>(1.00727646677e-3,1.0e-13)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_p,(value_and_uncertainty<double>(1.00727646677e-3,1.0e-13)*kilograms/mole)); /// proton Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_p,(measurement<double>(1.3214098446e-15,1.9e-24)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_p,(value_and_uncertainty<double>(1.3214098446e-15,1.9e-24)*meters)); /// proton rms charge radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_p,(measurement<double>(0.8768e-15,6.9e-18)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(R_p,(value_and_uncertainty<double>(0.8768e-15,6.9e-18)*meters)); /// proton magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p,(measurement<double>(1.410606662e-26,3.7e-34)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p,(value_and_uncertainty<double>(1.410606662e-26,3.7e-34)*joules/tesla)); /// proton-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_B,(measurement<double>(1.521032209e-3,1.2e-11)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_B,(value_and_uncertainty<double>(1.521032209e-3,1.2e-11)*dimensionless())); /// proton-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_N,(measurement<double>(2.792847356,2.3e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_N,(value_and_uncertainty<double>(2.792847356,2.3e-8)*dimensionless())); /// proton g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_p,(measurement<double>(5.585694713,4.6e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(g_p,(value_and_uncertainty<double>(5.585694713,4.6e-8)*dimensionless())); /// proton-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_n,(measurement<double>(-1.45989806,3.4e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_n,(value_and_uncertainty<double>(-1.45989806,3.4e-7)*dimensionless())); /// shielded proton magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime,(measurement<double>(1.410570419e-26,3.8e-34)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime,(value_and_uncertainty<double>(1.410570419e-26,3.8e-34)*joules/tesla)); /// shielded proton-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime_over_mu_B,(measurement<double>(1.520993128e-3,1.7e-11)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime_over_mu_B,(value_and_uncertainty<double>(1.520993128e-3,1.7e-11)*dimensionless())); /// shielded proton-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime_over_mu_N,(measurement<double>(2.792775598,3.0e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime_over_mu_N,(value_and_uncertainty<double>(2.792775598,3.0e-8)*dimensionless())); /// proton magnetic shielding correction -BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_p_prime,(measurement<double>(25.694e-6,1.4e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_p_prime,(value_and_uncertainty<double>(25.694e-6,1.4e-8)*dimensionless())); /// proton gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_p,(measurement<double>(2.675222099e8,7.0e0)/second/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_p,(value_and_uncertainty<double>(2.675222099e8,7.0e0)/second/tesla)); /// shielded proton gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_p_prime,(measurement<double>(2.675153362e8,7.3e0)/second/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_p_prime,(value_and_uncertainty<double>(2.675153362e8,7.3e0)/second/tesla)); /// neutron mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n,(measurement<double>(1.674927211e-27,8.4e-35)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n,(value_and_uncertainty<double>(1.674927211e-27,8.4e-35)*kilograms)); /// neutron-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_e,(measurement<double>(1838.6836605,1.1e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_e,(value_and_uncertainty<double>(1838.6836605,1.1e-6)*dimensionless())); /// neutron-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_mu,(measurement<double>(8.89248409,2.3e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_mu,(value_and_uncertainty<double>(8.89248409,2.3e-7)*dimensionless())); /// neutron-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_tau,(measurement<double>(0.528740,8.6e-5)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_tau,(value_and_uncertainty<double>(0.528740,8.6e-5)*dimensionless())); /// neutron-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_p,(measurement<double>(1.00137841918,4.6e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_p,(value_and_uncertainty<double>(1.00137841918,4.6e-10)*dimensionless())); /// neutron molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_n,(measurement<double>(1.00866491597e-3,4.3e-13)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_n,(value_and_uncertainty<double>(1.00866491597e-3,4.3e-13)*kilograms/mole)); /// neutron Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_n,(measurement<double>(1.3195908951e-15,2.0e-24)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_n,(value_and_uncertainty<double>(1.3195908951e-15,2.0e-24)*meters)); /// neutron magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n,(measurement<double>(-0.96623641e-26,2.3e-33)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n,(value_and_uncertainty<double>(-0.96623641e-26,2.3e-33)*joules/tesla)); /// neutron g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_n,(measurement<double>(-3.82608545,9.0e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(g_n,(value_and_uncertainty<double>(-3.82608545,9.0e-7)*dimensionless())); /// neutron-electron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_e,(measurement<double>(1.04066882e-3,2.5e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_e,(value_and_uncertainty<double>(1.04066882e-3,2.5e-10)*dimensionless())); /// neutron-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_p,(measurement<double>(-0.68497934,1.6e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_p,(value_and_uncertainty<double>(-0.68497934,1.6e-7)*dimensionless())); /// neutron-shielded proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_p_prime,(measurement<double>(-0.68499694,1.6e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_p_prime,(value_and_uncertainty<double>(-0.68499694,1.6e-7)*dimensionless())); /// neutron gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_n,(measurement<double>(1.83247185e8,4.3e1)/second/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_n,(value_and_uncertainty<double>(1.83247185e8,4.3e1)/second/tesla)); /// deuteron mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d,(measurement<double>(3.34358320e-27,1.7e-34)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d,(value_and_uncertainty<double>(3.34358320e-27,1.7e-34)*kilograms)); /// deuteron-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d_over_m_e,(measurement<double>(3670.4829654,1.6e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d_over_m_e,(value_and_uncertainty<double>(3670.4829654,1.6e-6)*dimensionless())); /// deuteron-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d_over_m_p,(measurement<double>(1.99900750108,2.2e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d_over_m_p,(value_and_uncertainty<double>(1.99900750108,2.2e-10)*dimensionless())); /// deuteron molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_d,(measurement<double>(2.013553212724e-3,7.8e-14)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_d,(value_and_uncertainty<double>(2.013553212724e-3,7.8e-14)*kilograms/mole)); /// deuteron rms charge radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_d,(measurement<double>(2.1402e-15,2.8e-18)*meters)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(R_d,(value_and_uncertainty<double>(2.1402e-15,2.8e-18)*meters)); /// deuteron magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d,(measurement<double>(0.433073465e-26,1.1e-34)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d,(value_and_uncertainty<double>(0.433073465e-26,1.1e-34)*joules/tesla)); /// deuteron-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_B,(measurement<double>(0.4669754556e-3,3.9e-12)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_B,(value_and_uncertainty<double>(0.4669754556e-3,3.9e-12)*dimensionless())); /// deuteron-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_N,(measurement<double>(0.8574382308,7.2e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_N,(value_and_uncertainty<double>(0.8574382308,7.2e-9)*dimensionless())); /// deuteron g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_d,(measurement<double>(0.8574382308,7.2e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(g_d,(value_and_uncertainty<double>(0.8574382308,7.2e-9)*dimensionless())); /// deuteron-electron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_e,(measurement<double>(-4.664345537e-4,3.9e-12)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_e,(value_and_uncertainty<double>(-4.664345537e-4,3.9e-12)*dimensionless())); /// deuteron-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_p,(measurement<double>(0.3070122070,2.4e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_p,(value_and_uncertainty<double>(0.3070122070,2.4e-9)*dimensionless())); /// deuteron-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_n,(measurement<double>(-0.44820652,1.1e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_n,(value_and_uncertainty<double>(-0.44820652,1.1e-7)*dimensionless())); /// triton mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t,(measurement<double>(5.00735588e-27,2.5e-34)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t,(value_and_uncertainty<double>(5.00735588e-27,2.5e-34)*kilograms)); /// triton-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t_over_m_e,(measurement<double>(5496.9215269,5.1e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t_over_m_e,(value_and_uncertainty<double>(5496.9215269,5.1e-6)*dimensionless())); /// triton-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t_over_m_p,(measurement<double>(2.9937170309,2.5e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t_over_m_p,(value_and_uncertainty<double>(2.9937170309,2.5e-9)*dimensionless())); /// triton molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_t,(measurement<double>(3.0155007134e-3,2.5e-12)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_t,(value_and_uncertainty<double>(3.0155007134e-3,2.5e-12)*kilograms/mole)); /// triton magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t,(measurement<double>(1.504609361e-26,4.2e-34)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t,(value_and_uncertainty<double>(1.504609361e-26,4.2e-34)*joules/tesla)); /// triton-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_B,(measurement<double>(1.622393657e-3,2.1e-11)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_B,(value_and_uncertainty<double>(1.622393657e-3,2.1e-11)*dimensionless())); /// triton-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_N,(measurement<double>(2.978962448,3.8e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_N,(value_and_uncertainty<double>(2.978962448,3.8e-8)*dimensionless())); /// triton g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_t,(measurement<double>(5.957924896,7.6e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(g_t,(value_and_uncertainty<double>(5.957924896,7.6e-8)*dimensionless())); /// triton-electron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_e,(measurement<double>(-1.620514423e-3,2.1e-11)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_e,(value_and_uncertainty<double>(-1.620514423e-3,2.1e-11)*dimensionless())); /// triton-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_p,(measurement<double>(1.066639908,1.0e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_p,(value_and_uncertainty<double>(1.066639908,1.0e-8)*dimensionless())); /// triton-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_n,(measurement<double>(-1.55718553,3.7e-7)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_n,(value_and_uncertainty<double>(-1.55718553,3.7e-7)*dimensionless())); /// helion mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h,(measurement<double>(5.00641192e-27,2.5e-34)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h,(value_and_uncertainty<double>(5.00641192e-27,2.5e-34)*kilograms)); /// helion-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h_over_m_e,(measurement<double>(5495.8852765,5.2e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h_over_m_e,(value_and_uncertainty<double>(5495.8852765,5.2e-6)*dimensionless())); /// helion-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h_over_m_p,(measurement<double>(2.9931526713,2.6e-9)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h_over_m_p,(value_and_uncertainty<double>(2.9931526713,2.6e-9)*dimensionless())); /// helion molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_h,(measurement<double>(3.0149322473e-3,2.6e-12)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_h,(value_and_uncertainty<double>(3.0149322473e-3,2.6e-12)*kilograms/mole)); /// helion shielded magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime,(measurement<double>(-1.074552982e-26,3.0e-34)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime,(value_and_uncertainty<double>(-1.074552982e-26,3.0e-34)*joules/tesla)); /// shielded helion-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_B,(measurement<double>(-1.158671471e-3,1.4e-11)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_B,(value_and_uncertainty<double>(-1.158671471e-3,1.4e-11)*dimensionless())); /// shielded helion-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_N,(measurement<double>(-2.127497718,2.5e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_N,(value_and_uncertainty<double>(-2.127497718,2.5e-8)*dimensionless())); /// shielded helion-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_p,(measurement<double>(-0.761766558,1.1e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_p,(value_and_uncertainty<double>(-0.761766558,1.1e-8)*dimensionless())); /// shielded helion-shielded proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_p_prime,(measurement<double>(-0.7617861313,3.3e-8)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_p_prime,(value_and_uncertainty<double>(-0.7617861313,3.3e-8)*dimensionless())); /// shielded helion gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_h_prime,(measurement<double>(2.037894730e8,5.6e-0)/second/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_h_prime,(value_and_uncertainty<double>(2.037894730e8,5.6e-0)/second/tesla)); /// alpha particle mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha,(measurement<double>(6.64465620e-27,3.3e-34)*kilograms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha,(value_and_uncertainty<double>(6.64465620e-27,3.3e-34)*kilograms)); /// alpha-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha_over_m_e,(measurement<double>(7294.2995365,3.1e-6)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha_over_m_e,(value_and_uncertainty<double>(7294.2995365,3.1e-6)*dimensionless())); /// alpha-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha_over_m_p,(measurement<double>(3.97259968951,4.1e-10)*dimensionless())); +BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha_over_m_p,(value_and_uncertainty<double>(3.97259968951,4.1e-10)*dimensionless())); /// alpha molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_alpha,(measurement<double>(4.001506179127e-3,6.2e-14)*kilograms/mole)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(M_alpha,(value_and_uncertainty<double>(4.001506179127e-3,6.2e-14)*kilograms/mole)); } // namespace CODATA Index: electromagnetic_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/electromagnetic_constants.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- electromagnetic_constants.hpp 3 Apr 2007 23:14:00 -0000 1.4 +++ electromagnetic_constants.hpp 5 Apr 2007 21:08:54 -0000 1.5 @@ -13,10 +13,9 @@ #if BOOST_UNITS_HAS_TYPEOF -#include <boost/units/measurement.hpp> #include <boost/units/static_constant.hpp> -//#include <boost/units/systems/si.hpp> +#include <boost/units/systems/si/constants.hpp> #include <boost/units/systems/si/conductance.hpp> #include <boost/units/systems/si/current.hpp> #include <boost/units/systems/si/electric_charge.hpp> @@ -45,21 +44,21 @@ // ELECTROMAGNETIC /// elementary charge -BOOST_UNITS_AUTO_STATIC_CONSTANT(e,(measurement<double>(1.602176487e-19,4.0e-27)*coulombs)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(e,(value_and_uncertainty<double>(1.602176487e-19,4.0e-27)*coulombs)); /// elementary charge to Planck constant ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_h,(measurement<double>(2.417989454e14,6.0e6)*amperes/joule)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_h,(value_and_uncertainty<double>(2.417989454e14,6.0e6)*amperes/joule)); /// magnetic flux quantum -BOOST_UNITS_AUTO_STATIC_CONSTANT(Phi_0,(measurement<double>(2.067833667e-15,5.2e-23)*webers)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(Phi_0,(value_and_uncertainty<double>(2.067833667e-15,5.2e-23)*webers)); /// conductance quantum -BOOST_UNITS_AUTO_STATIC_CONSTANT(G_0,(measurement<double>(7.7480917004e-5,5.3e-14)*siemens)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(G_0,(value_and_uncertainty<double>(7.7480917004e-5,5.3e-14)*siemens)); /// Josephson constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(K_J,(measurement<double>(483597.891e9,1.2e7)*hertz/volt)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(K_J,(value_and_uncertainty<double>(483597.891e9,1.2e7)*hertz/volt)); /// von Klitzing constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_K,(measurement<double>(25812.807557,1.77e-5)*ohms)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(R_K,(value_and_uncertainty<double>(25812.807557,1.77e-5)*ohms)); /// Bohr magneton -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_B,(measurement<double>(927.400915e-26,2.3e-31)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_B,(value_and_uncertainty<double>(927.400915e-26,2.3e-31)*joules/tesla)); /// nuclear magneton -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_N,(measurement<double>(5.05078324e-27,1.3e-34)*joules/tesla)); +BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_N,(value_and_uncertainty<double>(5.05078324e-27,1.3e-34)*joules/tesla)); } // namespace CODATA |
|
From: Matthias S. <mat...@us...> - 2007-04-05 21:08:55
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31276/systems/si Modified Files: codata_constants.hpp constants.hpp Log Message: remove measurement.hpp Index: constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/constants.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- constants.hpp 16 Mar 2007 18:12:45 -0000 1.1.1.1 +++ constants.hpp 5 Apr 2007 21:08:54 -0000 1.2 @@ -11,6 +11,99 @@ #ifndef BOOST_UNITS_CONSTANTS_HPP #define BOOST_UNITS_CONSTANTS_HPP +#include <cmath> +#include <iosfwd> +#include <iomanip> + +#include <boost/io/ios_state.hpp> + +namespace boost { + +namespace units { + +template<class Y> +class value_and_uncertainty +{ + public: + typedef value_and_uncertainty<Y> this_type; + typedef Y value_type; + + value_and_uncertainty(const value_type& val = value_type(), + const value_type& err = value_type()) : + value_(val), + uncertainty_(std::abs(err)) + { } + + value_and_uncertainty(const this_type& source) : + value_(source.value_), + uncertainty_(source.uncertainty_) + { } + + //~value_and_uncertainty() { } + + this_type& operator=(const this_type& source) + { + value_ = source.value_; + uncertainty_ = source.uncertainty_; + + return *this; + } + + operator value_type() const { return value_; } + + value_type value() const { return value_; } + value_type uncertainty() const { return uncertainty_; } + value_type lower_bound() const { return value_-uncertainty_; } + value_type upper_bound() const { return value_+uncertainty_; } + + private: + value_type value_, + uncertainty_; +}; + +// stream output +template<class Y> +inline +std::ostream& operator<<(std::ostream& os,const value_and_uncertainty<Y>& val) +{ + boost::io::ios_precision_saver precision_saver(os); + boost::io::ios_width_saver width_saver(os); + boost::io::ios_flags_saver flags_saver(os); + + os << std::setw(21); + + if (val.uncertainty() > Y(0)) + { + const Y relative_uncertainty = std::abs(val.uncertainty()/val.value()); + + const double exponent = std::log10(relative_uncertainty); + const long digits_of_precision = static_cast<long>(std::ceil(std::abs(exponent)))+3; + + // should try to replicate NIST CODATA syntax + os << std::setprecision(digits_of_precision) + //<< std::setw(digits_of_precision+8) + //<< std::scientific + << val.value(); +// << long(10*(relative_uncertainty/std::pow(Y(10),Y(exponent)))); + + os << " (rel. unc. = " + << std::setprecision(1) + << std::setw(7) + << std::scientific + << relative_uncertainty << ")"; + } + else + { + os << val.value() << " (exact)"; + } + + return os; +} + +} // namespace units + +} // namespace boost + #include <boost/units/systems/si/codata_constants.hpp> #endif // BOOST_UNITS_CONSTANTS_HPP Index: codata_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata_constants.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- codata_constants.hpp 3 Apr 2007 23:14:00 -0000 1.3 +++ codata_constants.hpp 5 Apr 2007 21:08:54 -0000 1.4 @@ -25,7 +25,7 @@ namespace CODATA { -typedef dimensionless_quantity<SI::system,double>::type dimensionless_constant; +//typedef dimensionless_quantity<SI::system,double>::type dimensionless_constant; } // namespace CODATA |
|
From: Matthias S. <mat...@us...> - 2007-04-05 21:08:54
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31276 Modified Files: conversion.hpp Removed Files: measurement.hpp Log Message: remove measurement.hpp --- measurement.hpp DELETED --- Index: conversion.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/conversion.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- conversion.hpp 29 Mar 2007 00:31:06 -0000 1.2 +++ conversion.hpp 5 Apr 2007 21:08:54 -0000 1.3 @@ -144,6 +144,14 @@ } }; +template<class FromUnit,class ToUnit,class Y> +inline +Y +conversion_factor() +{ + return quantity<ToUnit,Y>(Y(1)*FromUnit()).value(); +}; + } // namespace units } // namespace boost |
|
From: Matthias S. <mat...@us...> - 2007-04-05 21:08:54
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31276/systems Modified Files: physical_units.hpp Log Message: remove measurement.hpp Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- physical_units.hpp 4 Apr 2007 20:07:39 -0000 1.11 +++ physical_units.hpp 5 Apr 2007 21:08:54 -0000 1.12 @@ -141,6 +141,9 @@ /// composite dimension for kinematic viscosity : L^2 T^-1 typedef derived_dimension<length_tag,2,time_tag,-1>::type kinematic_viscosity_type; +/// composite dimension for luminance : L^-2 I +typedef derived_dimension<length_tag,-2,luminous_intensity_tag,1>::type luminance_type; + /// composite dimension for luminous flux : I QS typedef derived_dimension<luminous_intensity_tag,1,solid_angle_tag,1>::type luminous_flux_type; |
|
From: Matthias S. <mat...@us...> - 2007-04-05 03:05:59
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26672/example Modified Files: unit_example_22.cpp Removed Files: measurement.hpp Log Message: remove redundant header --- measurement.hpp DELETED --- Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- unit_example_22.cpp 5 Apr 2007 00:36:58 -0000 1.10 +++ unit_example_22.cpp 5 Apr 2007 03:05:44 -0000 1.11 @@ -348,7 +348,7 @@ return 0; } */ - +/* #include <iostream> #include <boost/units/io.hpp> @@ -389,7 +389,7 @@ return 0; } - +*/ /* #define MCS_USE_BOOST_REGEX_DEMANGLING @@ -413,5 +413,21 @@ return 0; } */ +#include <iostream> + +#include <boost/units/io.hpp> +#include <boost/units/quantity.hpp> +#include <boost/units/systems/si/force.hpp> +#include <boost/units/systems/cgs/force.hpp> + +int main() +{ + using namespace boost; + using namespace boost::units; + + std::cout << quantity<SI::dimensionless>(1.0*CGS::dyne/SI::newton) << std::endl; + + return 0; +} |