Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60069 - in branches/units/autoprefix: boost/units libs/units/test
From: steven_at_[hidden]
Date: 2010-03-01 22:56:36


Author: steven_watanabe
Date: 2010-03-01 22:56:35 EST (Mon, 01 Mar 2010)
New Revision: 60069
URL: http://svn.boost.org/trac/boost/changeset/60069

Log:
Make scaling by x^0 a no-op
Text files modified:
   branches/units/autoprefix/boost/units/make_scaled_unit.hpp | 15 +++++++++++++++
   branches/units/autoprefix/boost/units/units_fwd.hpp | 2 ++
   branches/units/autoprefix/libs/units/test/test_output.cpp | 5 +++++
   3 files changed, 22 insertions(+), 0 deletions(-)

Modified: branches/units/autoprefix/boost/units/make_scaled_unit.hpp
==============================================================================
--- branches/units/autoprefix/boost/units/make_scaled_unit.hpp (original)
+++ branches/units/autoprefix/boost/units/make_scaled_unit.hpp 2010-03-01 22:56:35 EST (Mon, 01 Mar 2010)
@@ -11,6 +11,7 @@
 #ifndef BOOST_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
 #define BOOST_UNITS_MAKE_SCALED_UNIT_HPP_INCLUDED
 
+#include <boost/units/units_fwd.hpp>
 #include <boost/units/heterogeneous_system.hpp>
 #include <boost/units/unit.hpp>
 
@@ -39,6 +40,20 @@
> type;
 };
 
+template<class Dimension, class UnitList, class OldScale, long Base>
+struct make_scaled_unit<unit<Dimension, heterogeneous_system<heterogeneous_system_impl<UnitList, Dimension, OldScale> > >, scale<Base, static_rational<0> > > {
+ typedef unit<
+ Dimension,
+ heterogeneous_system<
+ heterogeneous_system_impl<
+ UnitList,
+ Dimension,
+ OldScale
+ >
+ >
+ > type;
+};
+
 }
 }
 

Modified: branches/units/autoprefix/boost/units/units_fwd.hpp
==============================================================================
--- branches/units/autoprefix/boost/units/units_fwd.hpp (original)
+++ branches/units/autoprefix/boost/units/units_fwd.hpp 2010-03-01 22:56:35 EST (Mon, 01 Mar 2010)
@@ -38,6 +38,8 @@
 
 template<class Dim,class System, class Enable=void> class unit;
 
+template<long Base, class Exponent> struct scale;
+
 template<class BaseUnitTag> struct base_unit_info;
 template<class System> struct dimensionless_unit;
 template<class T> struct is_unit;

Modified: branches/units/autoprefix/libs/units/test/test_output.cpp
==============================================================================
--- branches/units/autoprefix/libs/units/test/test_output.cpp (original)
+++ branches/units/autoprefix/libs/units/test/test_output.cpp 2010-03-01 22:56:35 EST (Mon, 01 Mar 2010)
@@ -249,3 +249,8 @@
 #undef FORMATTERS
 }
 
+BOOST_AUTO_TEST_CASE(test_output_prefixed) {
+#define FORMATTERS << boost::units::name_format << boost::units::engineering_prefix
+ BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 meter second^-1");
+#undef FORMATTERS
+}


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