Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4146/example
Modified Files:
test_system.hpp unit_example_15.cpp unit_example_22.cpp
Log Message:
added BOOST_UNITS_REGISTER_BASE_DIMENSION macro
Index: unit_example_15.cpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_15.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- unit_example_15.cpp 5 Apr 2007 21:09:34 -0000 1.4
+++ unit_example_15.cpp 11 Apr 2007 21:24:04 -0000 1.5
@@ -34,10 +34,14 @@
namespace units {
-namespace wo {
+// fails due to redefinition of tag
+//BOOST_UNITS_REGISTER_BASE_DIMENSION(erroneous_tag,-1);
+BOOST_UNITS_REGISTER_BASE_DIMENSION(world_space_tag,101);
+BOOST_UNITS_REGISTER_BASE_DIMENSION(object_space_tag,102);
+//typedef base_dimension<101> world_space_tag;
+//typedef base_dimension<102> object_space_tag;
-typedef base_dimension<101> world_space_tag;
-typedef base_dimension<102> object_space_tag;
+namespace wo {
typedef world_space_tag::type world_space_type;
typedef object_space_tag::type object_space_type;
Index: unit_example_22.cpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- unit_example_22.cpp 10 Apr 2007 23:13:05 -0000 1.14
+++ unit_example_22.cpp 11 Apr 2007 21:24:04 -0000 1.15
@@ -413,7 +413,6 @@
return 0;
}
*/
-
#include <iostream>
#include <boost/units/io.hpp>
@@ -429,6 +428,11 @@
#include <boost/units/systems/other/non_si_units.hpp>
+struct blah { };
+struct blahblah { };
+
+blahblah operator+(const blah&) { return blahblah(); }
+
int main()
{
using namespace boost;
@@ -443,6 +447,10 @@
std::cout << conversion_factor<double>(SI::momentum()/SI::mass(),CGS::momentum()/CGS::mass()) << std::endl;
std::cout << conversion_factor<double>(CGS::gal,SI::meter_per_second_squared) << std::endl;
+ blah b;
+
+ std::cout << typeid(+b).name() << std::cout;
+
return 0;
}
Index: test_system.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/test_system.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test_system.hpp 10 Apr 2007 23:13:05 -0000 1.4
+++ test_system.hpp 11 Apr 2007 21:24:04 -0000 1.5
@@ -23,9 +23,12 @@
namespace units {
//[test_system_snippet_1
-typedef base_dimension<1> length_dim;
-typedef base_dimension<2> mass_dim;
-typedef base_dimension<3> time_dim;
+BOOST_UNITS_REGISTER_BASE_DIMENSION(length_dim,1); ///> base dimension of length
+BOOST_UNITS_REGISTER_BASE_DIMENSION(mass_dim,2); ///> base dimension of mass
+BOOST_UNITS_REGISTER_BASE_DIMENSION(time_dim,3); ///> base dimension of time
+//typedef base_dimension<1> length_dim;
+//typedef base_dimension<2> mass_dim;
+//typedef base_dimension<3> time_dim;
//]
#if 0
|