Boost logo

Boost-Commit :

From: boost_at_[hidden]
Date: 2008-06-01 04:42:07


Author: matthiasschabel
Date: 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
New Revision: 46011
URL: http://svn.boost.org/trac/boost/changeset/46011

Log:
remove stringstream stuff, minor fixes/updates
Text files modified:
   sandbox/units/libs/units/example/complex.cpp | 74 +++-----------------------
   sandbox/units/libs/units/example/conversion.cpp | 85 +++++------------------------
   sandbox/units/libs/units/example/dimension.cpp | 3
   sandbox/units/libs/units/example/heterogeneous_unit.cpp | 83 ++++++-----------------------
   sandbox/units/libs/units/example/kitchen_sink.cpp | 97 +++++++++++++++------------------
   sandbox/units/libs/units/example/quantity.cpp | 68 +-----------------------
   sandbox/units/libs/units/example/quaternion.cpp | 61 +-------------------
   sandbox/units/libs/units/example/radar_beam_height.cpp | 113 ++++++++-------------------------------
   sandbox/units/libs/units/example/temperature.cpp | 71 +-----------------------
   sandbox/units/libs/units/example/test_system.hpp | 8 +-
   sandbox/units/libs/units/example/tutorial.cpp | 12 ++--
   sandbox/units/libs/units/example/unit.cpp | 51 -----------------
   12 files changed, 137 insertions(+), 589 deletions(-)

Modified: sandbox/units/libs/units/example/complex.cpp
==============================================================================
--- sandbox/units/libs/units/example/complex.cpp (original)
+++ sandbox/units/libs/units/example/complex.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -51,8 +51,6 @@
 #include <cmath>
 #include <complex>
 #include <iostream>
-#include <sstream>
-#include <algorithm>
 
 #include <boost/mpl/list.hpp>
 
@@ -98,17 +96,20 @@
             r_ += val;
             return *this;
         }
+
         this_type& operator-=(const T& val)
         {
             r_ -= val;
             return *this;
         }
+
         this_type& operator*=(const T& val)
         {
             r_ *= val;
             i_ *= val;
             return *this;
         }
+
         this_type& operator/=(const T& val)
         {
             r_ /= val;
@@ -122,17 +123,20 @@
             i_ += source.i_;
             return *this;
         }
+
         this_type& operator-=(const this_type& source)
         {
             r_ -= source.r_;
             i_ -= source.i_;
             return *this;
         }
+
         this_type& operator*=(const this_type& source)
         {
             *this = *this * source;
             return *this;
         }
+
         this_type& operator/=(const this_type& source)
         {
             *this = *this / source;
@@ -367,8 +371,6 @@
     using namespace boost::math;
     using namespace boost::units;
     using namespace boost::units::test;
-
- std::stringstream sstream1, sstream2;
     
     {
     //[complex_snippet_1
@@ -377,7 +379,7 @@
     length_dimension L(complex<double>(2.0,1.0)*meters);
     //]
     
- sstream1 << "+L = " << +L << std::endl
+ std::cout << "+L = " << +L << std::endl
               << "-L = " << -L << std::endl
               << "L+L = " << L+L << std::endl
               << "L-L = " << L-L << std::endl
@@ -397,7 +399,7 @@
     length_dimension L(2.0*meters,1.0*meters);
     //]
     
- sstream1 << "+L = " << +L << std::endl
+ std::cout << "+L = " << +L << std::endl
               << "-L = " << -L << std::endl
               << "L+L = " << L+L << std::endl
               << "L-L = " << L-L << std::endl
@@ -410,63 +412,5 @@
               << std::endl;
     }
 
-
-// Expected output:
-
-
- sstream2 << "+L = 2 + 1 i m" << std::endl;
- sstream2 << "-L = -2 + -1 i m" << std::endl;
- sstream2 << "L+L = 4 + 2 i m" << std::endl;
- sstream2 << "L-L = 0 + 0 i m" << std::endl;
- sstream2 << "L*L = 3 + 4 i m^2" << std::endl;
- sstream2 << "L/L = 1 + 0 i dimensionless" << std::endl;
- sstream2 << "L^3 = 2 + 11 i m^3" << std::endl;
- sstream2 << "L^(3/2) = 2.56713 + " << 2.14246818967038 << " i m^(3/2)" << std::endl;
- sstream2 << "3vL = 1.29207 + 0.201294 i m^(1/3)" << std::endl;
- sstream2 << "(3/2)vL = " << 1.62893714592218 << " + " << 0.520174502304546 << " i m^(2/3)" << std::endl;
- sstream2 << std::endl;
- sstream2 << "+L = 2 m + 1 m i" << std::endl;
- sstream2 << "-L = -2 m + -1 m i" << std::endl;
- sstream2 << "L+L = 4 m + 2 m i" << std::endl;
- sstream2 << "L-L = 0 m + 0 m i" << std::endl;
- sstream2 << "L*L = 3 m^2 + 4 m^2 i" << std::endl;
- sstream2 << "L/L = 1 dimensionless + 0 dimensionless i" << std::endl;
- sstream2 << "L^3 = 2 m^3 + 11 m^3 i" << std::endl;
- sstream2 << "L^(3/2) = 2.56713 m^(3/2) + " << 2.14246818967038 << " m^(3/2) i" << std::endl;
- sstream2 << "3vL = 1.29207 m^(1/3) + 0.201294 m^(1/3) i" << std::endl;
- sstream2 << "(3/2)vL = " << 1.62893714592218 << " m^(2/3) + " << 0.520174502304546 << " m^(2/3) i" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }

Modified: sandbox/units/libs/units/example/conversion.cpp
==============================================================================
--- sandbox/units/libs/units/example/conversion.cpp (original)
+++ sandbox/units/libs/units/example/conversion.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -35,7 +35,7 @@
 volume (m^3) = 1 m^3
 
 energy (joules) = 1 J
-energy (ergs) = 1e+07 cm^2 g s^-2
+energy (ergs) = 1e+07 erg
 energy (joules) = 1 J
 
 velocity (2 m/s) = 2 m s^-1
@@ -46,12 +46,11 @@
 **/
 
 #include <iostream>
-#include <sstream>
-#include <algorithm>
 
 #include <boost/units/io.hpp>
 #include <boost/units/pow.hpp>
 #include <boost/units/systems/cgs.hpp>
+#include <boost/units/systems/cgs/io.hpp>
 #include <boost/units/systems/si.hpp>
 #include <boost/units/systems/si/io.hpp>
 
@@ -59,9 +58,6 @@
 
 int main()
 {
-
- std::stringstream sstream1, sstream2;
-
     // test quantity_cast
     {
     // implicit value_type conversions
@@ -84,7 +80,7 @@
     
     swap(L5,L6);
     
- sstream1 << "L1 = " << L1 << std::endl
+ std::cout << "L1 = " << L1 << std::endl
               << "L2 = " << L2 << std::endl
               << "L3 = " << L3 << std::endl
               << "L4 = " << L4 << std::endl
@@ -109,71 +105,20 @@
                             v2(2.0*cgs::centimeters/cgs::second);
     //]
     
- sstream1 << "volume (m^3) = " << vs << std::endl
- << "volume (cm^3) = " << vc << std::endl
- << "volume (m^3) = " << vs2 << std::endl
- << std::endl;
+ std::cout << "volume (m^3) = " << vs << std::endl
+ << "volume (cm^3) = " << vc << std::endl
+ << "volume (m^3) = " << vs2 << std::endl
+ << std::endl;
             
- sstream1 << "energy (joules) = " << es << std::endl
- << "energy (ergs) = " << ec << std::endl
- << "energy (joules) = " << es2 << std::endl
- << std::endl;
+ std::cout << "energy (joules) = " << es << std::endl
+ << "energy (ergs) = " << ec << std::endl
+ << "energy (joules) = " << es2 << std::endl
+ << std::endl;
             
- sstream1 << "velocity (2 m/s) = " << v1 << std::endl
- << "velocity (2 cm/s) = " << v2 << std::endl
- << std::endl;
+ std::cout << "velocity (2 m/s) = " << v1 << std::endl
+ << "velocity (2 cm/s) = " << v2 << std::endl
+ << std::endl;
     }
-
- sstream2 << "L1 = 2 m" << std::endl;
- sstream2 << "L2 = 2 m" << std::endl;
- sstream2 << "L3 = 2 m" << std::endl;
- sstream2 << "L4 = 200 cm" << std::endl;
- sstream2 << "L5 = 5 m" << std::endl;
- sstream2 << "L6 = 4 m" << std::endl;
- sstream2 << "L7 = 200 cm" << std::endl;
- sstream2 << std::endl;
- sstream2 << "volume (m^3) = 1 m^3" << std::endl;
- sstream2 << "volume (cm^3) = " << 1e6 << " cm^3" << std::endl;
- sstream2 << "volume (m^3) = 1 m^3" << std::endl;
- sstream2 << std::endl;
- sstream2 << "energy (joules) = 1 J" << std::endl;
- sstream2 << "energy (ergs) = " << 1e7 << " cm^2 g s^-2" << std::endl;
- sstream2 << "energy (joules) = 1 J" << std::endl;
- sstream2 << std::endl;
- sstream2 << "velocity (2 m/s) = 2 m s^-1" << std::endl;
- sstream2 << "velocity (2 cm/s) = 0.02 m s^-1" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
 
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }

Modified: sandbox/units/libs/units/example/dimension.cpp
==============================================================================
--- sandbox/units/libs/units/example/dimension.cpp (original)
+++ sandbox/units/libs/units/example/dimension.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -35,7 +35,6 @@
 // undefine this if you don't want to demangle symbols
 // need to link with libboost_regex to get demangling functionality
 #define MCS_USE_DEMANGLING
-//#define MCS_USE_BOOST_REGEX_DEMANGLING
 
 #include <boost/type_traits/is_same.hpp>
 
@@ -82,7 +81,7 @@
               << simplify_typename(time_dimension()) << std::endl
               << "energy_dimension = "
               << simplify_typename(energy_dimension()) << std::endl;
-
+
     //[dimension_snippet_1
     typedef mpl::times<length_dimension,mass_dimension>::type LM_type;
     typedef mpl::divides<length_dimension,time_dimension>::type L_T_type;

Modified: sandbox/units/libs/units/example/heterogeneous_unit.cpp
==============================================================================
--- sandbox/units/libs/units/example/heterogeneous_unit.cpp (original)
+++ sandbox/units/libs/units/example/heterogeneous_unit.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -33,6 +33,7 @@
 //]
 
 //[heterogeneous_unit_output_2
+1.5 cm m
 0.015 m^2
 //]
 
@@ -43,8 +44,6 @@
 //#define MCS_USE_BOOST_REGEX_DEMANGLING
 
 #include <iostream>
-#include <sstream>
-#include <algorithm>
 
 #include <boost/units/io.hpp>
 #include <boost/units/pow.hpp>
@@ -57,78 +56,32 @@
 
 int main()
 {
- std::stringstream sstream1, sstream2;
-
     //[heterogeneous_unit_snippet_1
     quantity<si::length> L(1.5*si::meter);
     quantity<cgs::mass> M(1.0*cgs::gram);
     
- sstream1 << L << std::endl
- << M << std::endl
- << L*M << std::endl
- << L/M << std::endl
- << std::endl;
+ std::cout << L << std::endl
+ << M << std::endl
+ << L*M << std::endl
+ << L/M << std::endl
+ << std::endl;
               
- sstream1 << 1.0*si::meter*si::kilogram/pow<2>(si::second) << std::endl
- << 1.0*si::meter*si::kilogram/pow<2>(si::second)/si::meter
- << std::endl << std::endl;
-
- sstream1 << 1.0*cgs::centimeter*si::kilogram/pow<2>(si::second) << std::endl
- << 1.0*cgs::centimeter*si::kilogram/pow<2>(si::second)/si::meter
- << std::endl << std::endl;
+ std::cout << 1.0*si::meter*si::kilogram/pow<2>(si::second) << std::endl
+ << 1.0*si::meter*si::kilogram/pow<2>(si::second)/si::meter
+ << std::endl << std::endl;
+
+ std::cout << 1.0*cgs::centimeter*si::kilogram/pow<2>(si::second) << std::endl
+ << 1.0*cgs::centimeter*si::kilogram/pow<2>(si::second)/si::meter
+ << std::endl << std::endl;
     //]
     
- //heterogeneous_unit_snippet_2
+ //[heterogeneous_unit_snippet_2
     quantity<si::area> A(1.5*si::meter*cgs::centimeter);
     
- sstream1 << A << std::endl
- << std::endl;
+ std::cout << 1.5*si::meter*cgs::centimeter << std::endl
+ << A << std::endl
+ << std::endl;
     //]
 
- sstream2 << "1.5 m" << std::endl
- << "1 g" << std::endl
- << "1.5 m g" << std::endl
- << "1.5 m g^-1" << std::endl
- << std::endl
- << "1 N" << std::endl
- << "1 kg s^-2" << std::endl
- << std::endl
- << "1 cm kg s^-2" << std::endl
- << "1 cm m^-1 kg s^-2" << std::endl
- << std::endl
- << "0.015 m^2" << std::endl
- << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }

Modified: sandbox/units/libs/units/example/kitchen_sink.cpp
==============================================================================
--- sandbox/units/libs/units/example/kitchen_sink.cpp (original)
+++ sandbox/units/libs/units/example/kitchen_sink.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -133,17 +133,12 @@
 //]
 
 //[kitchen_sink_output_15
-m^2 kg s^-1 rad^-1
-dimensionless
-m^2 kg s^-2 rad^-1
-dimensionless
-J
+I*w = m^2 kg s^-1 rad^-1
+I*w/L = dimensionless
+I*w^2 = J
 //]
 
 //[kitchen_sink_output_16
-//]
-
-//[kitchen_sink_output_17
 1 F
 1 kat
 1 S
@@ -159,7 +154,7 @@
 1 T
 1 W
 1 Pa
-1 Ω
+1 Ohm
 //]
 
 //[kitchen_sink_output_18
@@ -187,8 +182,6 @@
 #include <cmath>
 #include <complex>
 #include <iostream>
-#include <algorithm>
-#include <sstream>
 
 #include <boost/typeof/std/complex.hpp>
 
@@ -453,58 +446,56 @@
               << std::endl << std::endl;
     }
     
- /// check angular units
+ /// check moment of inertia/angular momentum/rotational energy
         
         //[kitchen_sink_snippet_9
         std::cout << symbol_format
- << moment_of_inertia()*angular_velocity() << std::endl
- << moment_of_inertia()*angular_velocity()/angular_momentum() << std::endl
- << moment_of_inertia()*angular_velocity()/seconds << std::endl
- << moment_of_inertia()*angular_velocity()/(torque()*seconds) << std::endl
- << moment_of_inertia()*pow<2>(angular_velocity()) << std::endl
+ << "I*w = " << moment_of_inertia()*angular_velocity() << std::endl
+ << "I*w/L = " << moment_of_inertia()*angular_velocity()/angular_momentum() << std::endl
+ << "I*w^2 = " << moment_of_inertia()*pow<2>(angular_velocity()) << std::endl
               << std::endl;
         //]
         
         //[kitchen_sink_snippet_10
- std::cout << typename_format
- << quantity<capacitance>(1.0*farad) << std::endl
- << quantity<catalytic_activity>(1.0*katal) << std::endl
- << quantity<conductance>(1.0*siemen) << std::endl
- << quantity<electric_charge>(1.0*coulomb) << std::endl
- << quantity<electric_potential>(1.0*volt) << std::endl
- << quantity<energy>(1.0*joule) << std::endl
- << quantity<force>(1.0*newton) << std::endl
- << quantity<frequency>(1.0*hertz) << std::endl
- << quantity<illuminance>(1.0*lux) << std::endl
- << quantity<inductance>(1.0*henry) << std::endl
- << quantity<luminous_flux>(1.0*lumen) << std::endl
- << quantity<magnetic_flux>(1.0*weber) << std::endl
- << quantity<magnetic_flux_density>(1.0*tesla) << std::endl
- << quantity<power>(1.0*watt) << std::endl
- << quantity<pressure>(1.0*pascals) << std::endl
- << quantity<resistance>(1.0*ohm) << std::endl
- << std::endl;
+// std::cout << typename_format
+// << quantity<capacitance>(1.0*farad) << std::endl
+// << quantity<catalytic_activity>(1.0*katal) << std::endl
+// << quantity<conductance>(1.0*siemen) << std::endl
+// << quantity<electric_charge>(1.0*coulomb) << std::endl
+// << quantity<electric_potential>(1.0*volt) << std::endl
+// << quantity<energy>(1.0*joule) << std::endl
+// << quantity<force>(1.0*newton) << std::endl
+// << quantity<frequency>(1.0*hertz) << std::endl
+// << quantity<illuminance>(1.0*lux) << std::endl
+// << quantity<inductance>(1.0*henry) << std::endl
+// << quantity<luminous_flux>(1.0*lumen) << std::endl
+// << quantity<magnetic_flux>(1.0*weber) << std::endl
+// << quantity<magnetic_flux_density>(1.0*tesla) << std::endl
+// << quantity<power>(1.0*watt) << std::endl
+// << quantity<pressure>(1.0*pascals) << std::endl
+// << quantity<resistance>(1.0*ohm) << std::endl
+// << std::endl;
     //]
         
         //[kitchen_sink_snippet_11
- std::cout << raw_format
- << quantity<capacitance>(1.0*farad) << std::endl
- << quantity<catalytic_activity>(1.0*katal) << std::endl
- << quantity<conductance>(1.0*siemen) << std::endl
- << quantity<electric_charge>(1.0*coulomb) << std::endl
- << quantity<electric_potential>(1.0*volt) << std::endl
- << quantity<energy>(1.0*joule) << std::endl
- << quantity<force>(1.0*newton) << std::endl
- << quantity<frequency>(1.0*hertz) << std::endl
- << quantity<illuminance>(1.0*lux) << std::endl
- << quantity<inductance>(1.0*henry) << std::endl
- << quantity<luminous_flux>(1.0*lumen) << std::endl
- << quantity<magnetic_flux>(1.0*weber) << std::endl
- << quantity<magnetic_flux_density>(1.0*tesla) << std::endl
- << quantity<power>(1.0*watt) << std::endl
- << quantity<pressure>(1.0*pascals) << std::endl
- << quantity<resistance>(1.0*ohm) << std::endl
- << std::endl;
+// std::cout << raw_format
+// << quantity<capacitance>(1.0*farad) << std::endl
+// << quantity<catalytic_activity>(1.0*katal) << std::endl
+// << quantity<conductance>(1.0*siemen) << std::endl
+// << quantity<electric_charge>(1.0*coulomb) << std::endl
+// << quantity<electric_potential>(1.0*volt) << std::endl
+// << quantity<energy>(1.0*joule) << std::endl
+// << quantity<force>(1.0*newton) << std::endl
+// << quantity<frequency>(1.0*hertz) << std::endl
+// << quantity<illuminance>(1.0*lux) << std::endl
+// << quantity<inductance>(1.0*henry) << std::endl
+// << quantity<luminous_flux>(1.0*lumen) << std::endl
+// << quantity<magnetic_flux>(1.0*weber) << std::endl
+// << quantity<magnetic_flux_density>(1.0*tesla) << std::endl
+// << quantity<power>(1.0*watt) << std::endl
+// << quantity<pressure>(1.0*pascals) << std::endl
+// << quantity<resistance>(1.0*ohm) << std::endl
+// << std::endl;
     //]
         
         //[kitchen_sink_snippet_12

Modified: sandbox/units/libs/units/example/quantity.cpp
==============================================================================
--- sandbox/units/libs/units/example/quantity.cpp (original)
+++ sandbox/units/libs/units/example/quantity.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -54,8 +54,6 @@
 
 #include <complex>
 #include <iostream>
-#include <sstream>
-#include <algorithm>
 
 #include <boost/mpl/list.hpp>
 
@@ -72,15 +70,13 @@
     using namespace boost::units;
     using namespace boost::units::test;
 
- std::stringstream sstream1, sstream2;
-
     {
     //[quantity_snippet_1
     quantity<length> L = 2.0*meters; // quantity of length
     quantity<energy> E = kilograms*pow<2>(L/seconds); // quantity of energy
     //]
     
- sstream1 << "L = " << L << std::endl
+ std::cout << "L = " << L << std::endl
               << "L+L = " << L+L << std::endl
               << "L-L = " << L-L << std::endl
               << "L*L = " << L*L << std::endl
@@ -107,7 +103,7 @@
     quantity<energy,std::complex<double> > E(kilograms*pow<2>(L/seconds));
     //]
     
- sstream1 << "L = " << L << std::endl
+ std::cout << "L = " << L << std::endl
               << "L+L = " << L+L << std::endl
               << "L-L = " << L-L << std::endl
               << "L*L = " << L*L << std::endl
@@ -128,63 +124,5 @@
               << std::endl;
     }
 
- sstream2 << "L = 2 m\n"
- << "L+L = 4 m\n"
- << "L-L = 0 m\n"
- << "L*L = 4 m^2\n"
- << "L/L = 1 dimensionless\n"
- << "L*meter = 2 m^2\n"
- << "kilograms*(L/seconds)*(L/seconds) = 4 m^2 kg s^-2\n"
- << "kilograms*(L/seconds)^2 = 4 m^2 kg s^-2\n"
- << "L^3 = 8 m^3\n"
- << "L^(3/2) = " << 2.82842712474619 << " m^(3/2)\n"
- << "2vL = " << 1.4142135623731 << " m^(1/2)\n"
- << "(3/2)vL = " << 1.5874010519682 << " m^(2/3)\n"
- << std::endl
- << "L = (3,4) m\n"
- << "L+L = (6,8) m\n"
- << "L-L = (0,0) m\n"
- << "L*L = (-7,24) m^2\n"
- << "L/L = (1,0) dimensionless\n"
- << "L*meter = (3,4) m^2\n"
- << "kilograms*(L/seconds)*(L/seconds) = (-7,24) m^2 kg s^-2\n"
- << "kilograms*(L/seconds)^2 = (-7,24) m^2 kg s^-2\n"
- << "L^3 = (-117,44) m^3\n"
- << "L^(3/2) = (2,11) m^(3/2)\n"
- << "2vL = (2,1) m^(1/2)\n"
- << "(3/2)vL = (" << 2.3828547125173 << "," << 1.69466313833091 << ") m^(2/3)\n"
- << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }

Modified: sandbox/units/libs/units/example/quaternion.cpp
==============================================================================
--- sandbox/units/libs/units/example/quaternion.cpp (original)
+++ sandbox/units/libs/units/example/quaternion.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -41,8 +41,6 @@
 **/
 
 #include <iostream>
-#include <sstream>
-#include <algorithm>
 
 #include <boost/math/quaternion.hpp>
 #include <boost/mpl/list.hpp>
@@ -53,7 +51,6 @@
 
 #include "test_system.hpp"
 
-
 #if BOOST_UNITS_HAS_BOOST_TYPEOF
 
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
@@ -184,8 +181,6 @@
     using namespace boost::units;
     using namespace boost::units::test;
     using boost::units::pow;
-
- std::stringstream sstream1, sstream2;
     
     {
     //[quaternion_snippet_1
@@ -194,13 +189,13 @@
     length_dimension L(quaternion<double>(4.0,3.0,2.0,1.0)*meters);
     //]
     
- sstream1 << "+L = " << +L << std::endl
+ std::cout << "+L = " << +L << std::endl
               << "-L = " << -L << std::endl
               << "L+L = " << L+L << std::endl
               << "L-L = " << L-L << std::endl
               << "L*L = " << L*L << std::endl
               << "L/L = " << L/L << std::endl
- << "L^3 = " << boost::units::pow<3>(L) << std::endl
+ << "L^3 = " << pow<3>(L) << std::endl
 // << "L^(3/2) = " << pow< static_rational<3,2> >(L) << std::endl
 // << "3vL = " << root<3>(L) << std::endl
 // << "(3/2)vL = " << root< static_rational<3,2> >(L) << std::endl
@@ -214,64 +209,18 @@
     length_dimension L(4.0*meters,3.0*meters,2.0*meters,1.0*meters);
     //]
     
- sstream1 << "+L = " << +L << std::endl
+ std::cout << "+L = " << +L << std::endl
               << "-L = " << -L << std::endl
               << "L+L = " << L+L << std::endl
               << "L-L = " << L-L << std::endl
 // << "L*L = " << L*L << std::endl
 // << "L/L = " << L/L << std::endl
- << "L^3 = " << boost::units::pow<3>(L) << std::endl
+ << "L^3 = " << pow<3>(L) << std::endl
 // << "L^(3/2) = " << pow< static_rational<3,2> >(L) << std::endl
 // << "3vL = " << root<3>(L) << std::endl
 // << "(3/2)vL = " << root< static_rational<3,2> >(L) << std::endl
               << std::endl;
     }
 
- sstream2 << "+L = (4,3,2,1) m" << std::endl;
- sstream2 << "-L = (-4,-3,-2,-1) m" << std::endl;
- sstream2 << "L+L = (8,6,4,2) m" << std::endl;
- sstream2 << "L-L = (0,0,0,0) m" << std::endl;
- sstream2 << "L*L = (2,24,16,8) m^2" << std::endl;
- sstream2 << "L/L = (1,0,0,0) dimensionless" << std::endl;
- sstream2 << "L^3 = (-104,102,68,34) m^3" << std::endl;
- sstream2 << std::endl;
- sstream2 << "+L = (4 m,3 m,2 m,1 m)" << std::endl;
- sstream2 << "-L = (-4 m,-3 m,-2 m,-1 m)" << std::endl;
- sstream2 << "L+L = (8 m,6 m,4 m,2 m)" << std::endl;
- sstream2 << "L-L = (0 m,0 m,0 m,0 m)" << std::endl;
- sstream2 << "L^3 = (-104 m^3,102 m^3,68 m^3,34 m^3)" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }

Modified: sandbox/units/libs/units/example/radar_beam_height.cpp
==============================================================================
--- sandbox/units/libs/units/example/radar_beam_height.cpp (original)
+++ sandbox/units/libs/units/example/radar_beam_height.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -34,8 +34,6 @@
 **/
 
 #include <iostream>
-#include <sstream>
-#include <algorithm>
 
 #include <boost/units/conversion.hpp>
 #include <boost/units/io.hpp>
@@ -43,86 +41,72 @@
 #include <boost/units/systems/si.hpp>
 #include <boost/units/systems/si/prefixes.hpp>
 
-namespace boost {
-
-namespace units {
+using boost::units::length_dimension;
+using boost::units::pow;
+using boost::units::root;
+using boost::units::quantity;
+using boost::units::unit;
 
 //[radar_beam_height_class_snippet_1
 namespace nautical {
 
-struct length_base_unit : base_unit<length_base_unit, length_dimension, 1>
+struct length_base_unit :
+ boost::units::base_unit<length_base_unit, length_dimension, 1>
 {
     static std::string name() { return "nautical mile"; }
     static std::string symbol() { return "nmi"; }
 };
 
-typedef make_system<length_base_unit>::type system;
+typedef boost::units::make_system<length_base_unit>::type system;
 
 /// unit typedefs
-typedef unit<length_dimension,system> length;
+typedef unit<length_dimension,system> length;
 
 static const length mile,miles;
 
 } // namespace nautical
 
 // helper for conversions between nautical length and si length
-
-} // namespace units
-
-} // namespace boost
-
-BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::nautical::length_base_unit,
+BOOST_UNITS_DEFINE_CONVERSION_FACTOR(nautical::length_base_unit,
                                      boost::units::si::meter_base_unit,
                                      double, 1.852e3);
-
-namespace boost {
-
-namespace units {
-
 //]
 
 //[radar_beam_height_class_snippet_2
 namespace imperial {
 
-struct length_base_unit : base_unit<length_base_unit, length_dimension, 2>
+struct length_base_unit :
+ boost::units::base_unit<length_base_unit, length_dimension, 2>
 {
     static std::string name() { return "foot"; }
     static std::string symbol() { return "ft"; }
 };
 
-typedef make_system<length_base_unit>::type system;
+typedef boost::units::make_system<length_base_unit>::type system;
 
 /// unit typedefs
-typedef unit<length_dimension,system> length;
+typedef unit<length_dimension,system> length;
 
 static const length foot,feet;
 
 } // imperial
 
-} // namespace units
-
-} // namespace boost
-
-BOOST_UNITS_DEFINE_CONVERSION_FACTOR(boost::units::imperial::length_base_unit,
+// helper for conversions between imperial length and si length
+BOOST_UNITS_DEFINE_CONVERSION_FACTOR(imperial::length_base_unit,
                                      boost::units::si::meter_base_unit,
                                      double, 1.0/3.28083989501312);
-
-namespace boost {
-
-namespace units {
-
 //]
 
 // radar beam height functions
 //[radar_beam_height_function_snippet_1
 template<class System,typename T>
-quantity<unit<length_dimension,System>,T>
+quantity<unit<boost::units::length_dimension,System>,T>
 radar_beam_height(const quantity<unit<length_dimension,System>,T>& radar_range,
                   const quantity<unit<length_dimension,System>,T>& earth_radius,
                   T k = 4.0/3.0)
 {
- return quantity<unit<length_dimension,System>,T>(
- pow<2>(radar_range)/(2.0*k*earth_radius));
+ return quantity<unit<length_dimension,System>,T>
+ (pow<2>(radar_range)/(2.0*k*earth_radius));
 }
 //]
 
@@ -130,7 +114,7 @@
 template<class return_type,class System1,class System2,typename T>
 return_type
 radar_beam_height(const quantity<unit<length_dimension,System1>,T>& radar_range,
- const quantity<unit<length_dimension,System2>,T>& earth_radius,
+ const quantity<unit<length_dimension,System2>,T>& earth_radius,
                   T k = 4.0/3.0)
 {
     // need to decide which system to use for calculation
@@ -145,23 +129,17 @@
 quantity<imperial::length>
 radar_beam_height(const quantity<nautical::length>& range)
 {
- return quantity<imperial::length>(
- pow<2>(range/(1.23*nautical::miles/root<2>(imperial::feet))));
+ return quantity<imperial::length>
+ (pow<2>(range/(1.23*nautical::miles/root<2>(imperial::feet))));
 }
 //]
 
-} // namespace units
-
-} // namespace boost
-
 int main(void)
 {
     using namespace boost::units;
     using namespace boost::units::si;
- using namespace boost::units::nautical;
+ using namespace nautical;
 
- std::stringstream sstream1, sstream2;
-
     //[radar_beam_height_snippet_1
     const quantity<nautical::length> radar_range(300.0*miles);
     const quantity<si::length> earth_radius(6371.0087714*kilo*meters);
@@ -172,7 +150,7 @@
     const quantity<nautical::length> beam_height_4(radar_beam_height< quantity<nautical::length> >(radar_range,earth_radius));
     //]
     
- sstream1 << "radar range : " << radar_range << std::endl
+ std::cout << "radar range : " << radar_range << std::endl
               << "earth radius : " << earth_radius << std::endl
               << "beam height 1 : " << beam_height_1 << std::endl
               << "beam height 2 : " << beam_height_2 << std::endl
@@ -183,47 +161,6 @@
               << "beam height approx : "
               << quantity<si::length>(radar_beam_height(radar_range))
               << std::endl << std::endl;
-
- sstream2 << "radar range : 300 nmi" << std::endl;
- sstream2 << "earth radius : " << 6371008.7714 << " m" << std::endl;
- sstream2 << "beam height 1 : " << 18169.690884692 << " m" << std::endl;
- sstream2 << "beam height 2 : " << 9.81084820987694 << " nmi" << std::endl;
- sstream2 << "beam height 3 : " << 18169.6908846921 << " m" << std::endl;
- sstream2 << "beam height 4 : " << 9.81084820987694 << " nmi" << std::endl;
- sstream2 << "beam height approx : " << 59488.3997620464 << " ft" << std::endl;
- sstream2 << "beam height approx : " << 18132.0642474718 << " m" << std::endl;
- sstream2 << std::endl;
 
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }

Modified: sandbox/units/libs/units/example/temperature.cpp
==============================================================================
--- sandbox/units/libs/units/example/temperature.cpp (original)
+++ sandbox/units/libs/units/example/temperature.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -20,6 +20,7 @@
 Output:
 @verbatim
 
+//[ temperature_output_1
 { 32 } °F
 { 273.15 } K
 { 273.15 } K
@@ -28,14 +29,13 @@
 [ 17.7778 ] K
 [ 17.7778 ] K
 [ 17.7778 ] K
+//]
 
 @endverbatim
 **/
 
-#include <algorithm>
 #include <iomanip>
 #include <iostream>
-#include <sstream>
 
 #include <boost/units/absolute.hpp>
 #include <boost/units/get_system.hpp>
@@ -56,13 +56,8 @@
 namespace fahrenheit {
 
 //[temperature_snippet_1
-// direct method
-//typedef make_system<temperature::fahrenheit_base_unit>::type system;
-//typedef unit<temperature_dimension,system> temperature;
-
-// simpler method for single-unit systems
 typedef temperature::fahrenheit_base_unit::unit_type temperature;
-typedef get_system<temperature>::type system;
+typedef get_system<temperature>::type system;
 
 BOOST_UNITS_STATIC_CONSTANT(degree,temperature);
 BOOST_UNITS_STATIC_CONSTANT(degrees,temperature);
@@ -70,19 +65,6 @@
 
 } // fahrenheit
 
-//template<>
-//struct is_implicitly_convertible<unit<temperature_dimension,fahrenheit::system>,
-// unit<temperature_dimension,si::system> > :
-// public mpl::true_
-//{ };
-
-//template<>
-//struct is_implicitly_convertible<
-// absolute< unit<temperature_dimension,fahrenheit::system> >,
-// absolute< unit<temperature_dimension,si::system> > > :
-// public mpl::true_
-//{ };
-
 //[temperature_snippet_2
 template<>
 struct is_implicitly_convertible<
@@ -101,8 +83,6 @@
 
 int main()
 {
- std::stringstream sstream1, sstream2;
-
     //[temperature_snippet_3
     quantity<absolute<fahrenheit::temperature> > T1p(
         32.0*absolute<fahrenheit::temperature>());
@@ -122,7 +102,7 @@
         quantity<fahrenheit::temperature>,
         quantity<si::temperature> > relative_conv_type;
     
- sstream1 << T1p << std::endl
+ std::cout << T1p << std::endl
               << absolute_conv_type::convert(T1p) << std::endl
               << T2p << std::endl
               << T3p << std::endl
@@ -131,47 +111,6 @@
               << T2v << std::endl
               << T3v << std::endl
               << std::endl;
-
- sstream2 << "32 absolute °F" << std::endl
- << "273.15 absolute K" << std::endl
- << "273.15 absolute K" << std::endl
- << "273.15 absolute K" << std::endl
- << "32 °F" << std::endl
- << 17.77777777777 << " K" << std::endl
- << 17.77777777777 << " K" << std::endl
- << 17.77777777777 << " K" << std::endl
- << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
 
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }

Modified: sandbox/units/libs/units/example/test_system.hpp
==============================================================================
--- sandbox/units/libs/units/example/test_system.hpp (original)
+++ sandbox/units/libs/units/example/test_system.hpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -89,9 +89,9 @@
 
 //[test_system_snippet_6
 
-struct meter_base_unit : base_unit<meter_base_unit, length_dimension, 1> {};
-struct kilogram_base_unit : base_unit<kilogram_base_unit, mass_dimension, 2> {};
-struct second_base_unit : base_unit<second_base_unit, time_dimension, 3> {};
+struct meter_base_unit : base_unit<meter_base_unit, length_dimension, 1> { };
+struct kilogram_base_unit : base_unit<kilogram_base_unit, mass_dimension, 2> { };
+struct second_base_unit : base_unit<second_base_unit, time_dimension, 3> { };
 
 typedef make_system<
     meter_base_unit,
@@ -99,7 +99,7 @@
     second_base_unit>::type mks_system;
 
 /// unit typedefs
-typedef unit<dimensionless_type,mks_system> dimensionless;
+typedef unit<dimensionless_type,mks_system> dimensionless;
 
 typedef unit<length_dimension,mks_system> length;
 typedef unit<mass_dimension,mks_system> mass;

Modified: sandbox/units/libs/units/example/tutorial.cpp
==============================================================================
--- sandbox/units/libs/units/example/tutorial.cpp (original)
+++ sandbox/units/libs/units/example/tutorial.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -20,14 +20,14 @@
 @verbatim
 
 //[tutorial_output
-F = 2 m kg s^(-2)
+F = 2 N
 dx = 2 m
-E = 4 m^2 kg s^(-2)
+E = 4 J
 
-V = (12.5,0) m^2 kg s^(-3) A^(-1)
+V = (12.5,0) V
 I = (3,4) A
-Z = (1.5,-2) m^2 kg s^(-3) A^(-2)
-I*Z = (12.5,0) m^2 kg s^(-3) A^(-1)
+Z = (1.5,-2) Ohm
+I*Z = (12.5,0) V
 I*Z == V? true
 //]
 
@@ -40,13 +40,13 @@
 
 #include <boost/typeof/std/complex.hpp>
 
-#include <boost/units/io.hpp>
 #include <boost/units/systems/si/energy.hpp>
 #include <boost/units/systems/si/force.hpp>
 #include <boost/units/systems/si/length.hpp>
 #include <boost/units/systems/si/electric_potential.hpp>
 #include <boost/units/systems/si/current.hpp>
 #include <boost/units/systems/si/resistance.hpp>
+#include <boost/units/systems/si/io.hpp>
 
 using namespace boost::units;
 using namespace boost::units::si;

Modified: sandbox/units/libs/units/example/unit.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit.cpp (original)
+++ sandbox/units/libs/units/example/unit.cpp 2008-06-01 04:42:05 EDT (Sun, 01 Jun 2008)
@@ -37,8 +37,6 @@
 **/
 
 #include <iostream>
-#include <sstream>
-#include <algorithm>
 
 #include "test_system.hpp"
 
@@ -57,9 +55,7 @@
     const energy E;
     //]
     
- std::stringstream sstream1, sstream2;
-
- sstream1 << "L = " << L << std::endl
+ std::cout << "L = " << L << std::endl
               << "L+L = " << L+L << std::endl
               << "L-L = " << L-L << std::endl
               << "L/L = " << L/L << std::endl
@@ -73,48 +69,5 @@
               << "(3/2)vM = " << root<static_rational<3,2> >(M)
               << std::endl;
 
- sstream2 << "L = m" << std::endl
- << "L+L = m" << std::endl
- << "L-L = m" << std::endl
- << "L/L = dimensionless" << std::endl
- << "meter*meter = m^2" << std::endl
- << "M*(L/T)*(L/T) = m^2 kg s^-2" << std::endl
- << "M*(L/T)^2 = m^2 kg s^-2" << std::endl
- << "L^3 = m^3" << std::endl
- << "L^(3/2) = m^(3/2)" << std::endl
- << "2vM = kg^(1/2)" << std::endl
- << "(3/2)vM = kg^(2/3)" << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter =
- std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter =
- std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
+ return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk