Boost logo

Boost-Commit :

From: steven_watanabe_at_[hidden]
Date: 2007-05-25 14:41:12


Author: steven_watanabe
Date: 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
New Revision: 4254
URL: http://svn.boost.org/trac/boost/changeset/4254

Log:
scaled_system->scaled_base_unit

Added:
   sandbox/units/boost/units/experimental/scaled_base_unit.hpp
      - copied, changed from r4228, /sandbox/units/boost/units/experimental/scaled_system.hpp
Removed:
   sandbox/units/boost/units/experimental/scaled_system.hpp
Text files modified:
   sandbox/units/boost/units/detail/prevent_ordinal_redefinition_impl.hpp | 5 ++
   sandbox/units/boost/units/experimental/base_unit.hpp | 8 ++--
   sandbox/units/boost/units/experimental/conversion.hpp | 6 +-
   sandbox/units/boost/units/experimental/fundamental_units.hpp | 6 +-
   sandbox/units/boost/units/experimental/heterogeneous_system.hpp | 2
   sandbox/units/boost/units/experimental/linear_algebra.hpp | 6 +-
   sandbox/units/boost/units/experimental/make_system.hpp | 2
   sandbox/units/boost/units/experimental/scaled_base_unit.hpp | 72 ++++++++++++++++++++--------------------
   sandbox/units/libs/units/test/test_header.hpp | 6 +-
   9 files changed, 59 insertions(+), 54 deletions(-)

Modified: sandbox/units/boost/units/detail/prevent_ordinal_redefinition_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/prevent_ordinal_redefinition_impl.hpp (original)
+++ sandbox/units/boost/units/detail/prevent_ordinal_redefinition_impl.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -41,6 +41,11 @@
 boost_units_is_registered(const T&)
 { return(detail::no()); }
 
+template<class T>
+detail::no
+boost_units_unit_is_registered(const T&)
+{ return(detail::no()); }
+
 } // namespace units
 
 } // namespace boost

Modified: sandbox/units/boost/units/experimental/base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/base_unit.hpp (original)
+++ sandbox/units/boost/units/experimental/base_unit.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -41,8 +41,8 @@
          class Dim,
          long N,
          class = typename detail::ordinal_has_already_been_defined<
- sizeof(boost_units_is_registered(units::base_unit_ordinal<N>())) == sizeof(detail::yes) &&
- sizeof(boost_units_is_registered(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes)
+ sizeof(boost_units_unit_is_registered(units::base_unit_ordinal<N>())) == sizeof(detail::yes) &&
+ sizeof(boost_units_unit_is_registered(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes)
>::type>
 class base_unit :
     public mpl::long_<N>
@@ -71,13 +71,13 @@
         /// Register this ordinal
         /// INTERNAL ONLY
         friend detail::yes
- boost_units_is_registered(const units::base_unit_ordinal<N>&)
+ boost_units_unit_is_registered(const units::base_unit_ordinal<N>&)
         { return(detail::yes()); }
         
         /// But make sure we can identify the current instantiation!
         /// INTERNAL ONLY
         friend detail::yes
- boost_units_is_registered(const units::base_unit_pair<Derived, N>&)
+ boost_units_unit_is_registered(const units::base_unit_pair<Derived, N>&)
         { return(detail::yes()); }
 };
 

Modified: sandbox/units/boost/units/experimental/conversion.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/conversion.hpp (original)
+++ sandbox/units/boost/units/experimental/conversion.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -18,7 +18,7 @@
 #include <boost/mpl/deref.hpp>
 #include <boost/mpl/divides.hpp>
 
-#include <boost/units/experimental/scaled_system.hpp>
+#include <boost/units/experimental/scaled_base_unit.hpp>
 #include <boost/units/experimental/make_system.hpp>
 #include <boost/units/experimental/heterogeneous_system.hpp>
 #include <boost/units/experimental/one.hpp>
@@ -52,7 +52,7 @@
     typedef typename mpl::divides<typename get_scale_list<Source>::type, typename get_scale_list<source_type>::type>::type source_factor;
     typedef typename mpl::divides<typename get_scale_list<Destination>::type, typename get_scale_list<destination_type>::type>::type destination_factor;
     typedef typename mpl::divides<source_factor, destination_factor>::type factor;
- typedef typename eval_scale_list<factor> eval_factor;
+ typedef eval_scale_list<factor> eval_factor;
     typedef typename multiply_typeof_helper<typename converter::type, typename eval_factor::type>::type type;
     static type value() {
         return(converter::value() * eval_factor::value());
@@ -73,7 +73,7 @@
         typedef typename mpl::divides<typename get_scale_list<Source>::type, typename get_scale_list<source_type>::type>::type source_factor;
         typedef typename mpl::divides<typename get_scale_list<Destination>::type, typename get_scale_list<destination_type>::type>::type destination_factor;
         typedef typename mpl::divides<source_factor, destination_factor>::type factor;
- typedef typename eval_scale_list<factor> eval_factor;
+ typedef eval_scale_list<factor> eval_factor;
         typedef typename multiply_typeof_helper<typename converter::type, typename eval_factor::type>::type type;
         static type value() {
             return(converter::value() * eval_factor::value());

Modified: sandbox/units/boost/units/experimental/fundamental_units.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/fundamental_units.hpp (original)
+++ sandbox/units/boost/units/experimental/fundamental_units.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -15,7 +15,7 @@
 
 #include <boost/units/systems/physical_units.hpp>
 #include <boost/units/experimental/base_unit.hpp>
-#include <boost/units/experimental/scaled_system.hpp>
+#include <boost/units/experimental/scaled_base_unit.hpp>
 
 namespace boost {
 
@@ -41,13 +41,13 @@
     static std::string name() { return("mile"); }
     static std::string symbol() { return("mi"); }
 };
-typedef scaled_system<meter_tag, scale<10, static_rational<-2> > > centimeter_tag;
+typedef scaled_base_unit<meter_tag, scale<10, static_rational<-2> > > centimeter_tag;
 
 struct gram_tag : public base_unit<gram_tag, mass_type, -15> {
     static std::string name() { return("gram"); }
     static std::string symbol() { return("g"); }
 };
-typedef scaled_system<gram_tag, scale<10, static_rational<3> > > kilogram_tag;
+typedef scaled_base_unit<gram_tag, scale<10, static_rational<3> > > kilogram_tag;
 
 struct second_tag : public base_unit<second_tag, time_type, -14> {
     static std::string name() { return("second"); }

Modified: sandbox/units/boost/units/experimental/heterogeneous_system.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/heterogeneous_system.hpp (original)
+++ sandbox/units/boost/units/experimental/heterogeneous_system.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -23,7 +23,7 @@
 #include <boost/units/static_rational.hpp>
 #include <boost/units/dimension.hpp>
 #include <boost/units/detail/push_front_if.hpp>
-#include <boost/units/experimental/scaled_system.hpp>
+#include <boost/units/experimental/scaled_base_unit.hpp>
 #include <boost/units/experimental/linear_algebra.hpp>
 
 namespace boost {

Modified: sandbox/units/boost/units/experimental/linear_algebra.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/linear_algebra.hpp (original)
+++ sandbox/units/boost/units/experimental/linear_algebra.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -485,7 +485,7 @@
     template<class T>
     struct apply {
         typedef static_rational<0> type;
- typedef typename T next;
+ typedef T next;
     };
 };
 
@@ -759,7 +759,7 @@
         // equation can always be adjusted by adjusting the
         // dummy unit we are adding now, independently of
         // other units, we don't need it anymore.)
- typedef typename typename mpl::advance_c<typename mpl::begin<ReverseEquations>::type, M>::type pos;
+ typedef typename mpl::advance_c<typename mpl::begin<ReverseEquations>::type, M>::type pos;
         // Continue with the main loop.
         typedef typename normalize_units_impl<N-1>::template apply<
             // Remove current_equation
@@ -1022,7 +1022,7 @@
 template<class T, class Dimensions>
 struct calculate_base_unit_exponents {
     // find the units that correspond to each base dimension
- typedef typename normalize_units<T> base_solutions;
+ typedef normalize_units<T> base_solutions;
     // pad the dimension with zeroes so it can just be a
     // list of numbers, making the multiplication easy
     // e.g. if the arguments are list<pound, foot> and

Modified: sandbox/units/boost/units/experimental/make_system.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/make_system.hpp (original)
+++ sandbox/units/boost/units/experimental/make_system.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -152,7 +152,7 @@
 
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
 
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::homogeneous_system, (class));
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::homogeneous_system, (class))
 
 #endif
 

Copied: sandbox/units/boost/units/experimental/scaled_base_unit.hpp (from r4228, /sandbox/units/boost/units/experimental/scaled_system.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/scaled_system.hpp (original)
+++ sandbox/units/boost/units/experimental/scaled_base_unit.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -47,7 +47,7 @@
 
 template<long Base>
 struct scale<Base, static_rational<0> > {
- enum { base = Base };
+ static const long base = Base;
     typedef static_rational<0> exponent;
     typedef one value_type;
     static one value() { return(one()); }
@@ -59,7 +59,7 @@
 template<> \
 struct scale<base_, exponent_> \
 { \
- enum { base = base_ }; \
+ static const long base = base_; \
     typedef exponent_ exponent; \
     typedef double value_type; \
     static value_type value() { return(val); } \
@@ -67,30 +67,30 @@
     static std::string symbol_prefix() { return(#symbol); } \
 }
 
-#define BOOST_UNITS_SCALE_DEF(exponent,name,symbol) \
- BOOST_UNITS_SCALE_SPECIALIZATION(10,static_rational<exponent>,1e ## exponent, name, symbol)
+#define BOOST_UNITS_SCALE_DEF(exponent,value,name,symbol) \
+ BOOST_UNITS_SCALE_SPECIALIZATION(10,static_rational<exponent>,value, name, symbol)
 
-BOOST_UNITS_SCALE_DEF(-24, yocto, y);
-BOOST_UNITS_SCALE_DEF(-21, zepto, z);
-BOOST_UNITS_SCALE_DEF(-18, atto, a);
-BOOST_UNITS_SCALE_DEF(-15, femto, f);
-BOOST_UNITS_SCALE_DEF(-12, pico, p);
-BOOST_UNITS_SCALE_DEF(-9, nano, n);
-BOOST_UNITS_SCALE_DEF(-6, micro, u);
-BOOST_UNITS_SCALE_DEF(-3, milli, m);
-BOOST_UNITS_SCALE_DEF(-2, centi, c);
-BOOST_UNITS_SCALE_DEF(-1, deci, d);
-
-BOOST_UNITS_SCALE_DEF(1, deka, da);
-BOOST_UNITS_SCALE_DEF(2, hecto, h);
-BOOST_UNITS_SCALE_DEF(3, kilo, k);
-BOOST_UNITS_SCALE_DEF(6, mega, M);
-BOOST_UNITS_SCALE_DEF(9, giga, G);
-BOOST_UNITS_SCALE_DEF(12, tera, T);
-BOOST_UNITS_SCALE_DEF(15, peta, P);
-BOOST_UNITS_SCALE_DEF(18, exa, E);
-BOOST_UNITS_SCALE_DEF(21, zetta, Z);
-BOOST_UNITS_SCALE_DEF(24, yotta, Y);
+BOOST_UNITS_SCALE_DEF(-24, 1e-24 ,yocto, y);
+BOOST_UNITS_SCALE_DEF(-21, 1e-21, zepto, z);
+BOOST_UNITS_SCALE_DEF(-18, 1e-18, atto, a);
+BOOST_UNITS_SCALE_DEF(-15, 1e-15, femto, f);
+BOOST_UNITS_SCALE_DEF(-12, 1e-12, pico, p);
+BOOST_UNITS_SCALE_DEF(-9, 1e-9, nano, n);
+BOOST_UNITS_SCALE_DEF(-6, 1e-6, micro, u);
+BOOST_UNITS_SCALE_DEF(-3, 1e-3, milli, m);
+BOOST_UNITS_SCALE_DEF(-2, 1e-2, centi, c);
+BOOST_UNITS_SCALE_DEF(-1, 1e-1, deci, d);
+
+BOOST_UNITS_SCALE_DEF(1, 1e1, deka, da);
+BOOST_UNITS_SCALE_DEF(2, 1e2, hecto, h);
+BOOST_UNITS_SCALE_DEF(3, 1e3, kilo, k);
+BOOST_UNITS_SCALE_DEF(6, 1e6, mega, M);
+BOOST_UNITS_SCALE_DEF(9, 1e9, giga, G);
+BOOST_UNITS_SCALE_DEF(12, 1e12, tera, T);
+BOOST_UNITS_SCALE_DEF(15, 1e15, peta, P);
+BOOST_UNITS_SCALE_DEF(18, 1e18, exa, E);
+BOOST_UNITS_SCALE_DEF(21, 1e21, zetta, Z);
+BOOST_UNITS_SCALE_DEF(24, 1e24, yotta, Y);
 
 BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<10>, 1024.0, kibi, Ki);
 BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<20>, 1048576.0, mebi, Mi);
@@ -102,13 +102,13 @@
 #undef BOOST_UNITS_SCALE_DEF
 #undef BOOST_UNITS_SCALE_SPECIALIZATION
 
-struct scaled_system_tag {};
+struct scaled_base_unit_tag {};
 
 template<class S, class Scale>
-struct scaled_system
+struct scaled_base_unit
 {
- typedef scaled_system type;
- typedef scaled_system_tag tag;
+ typedef scaled_base_unit type;
+ typedef scaled_base_unit_tag tag;
     typedef S system_type;
     typedef Scale scale_type;
     typedef typename S::dimension_type dimension_type;
@@ -117,7 +117,7 @@
         heterogeneous_system<
             heterogeneous_system_pair<
                 dimension_list<
- heterogeneous_system_dim<scaled_system,static_rational<1> >,
+ heterogeneous_system_dim<scaled_base_unit,static_rational<1> >,
                     dimensionless_type
>,
                 dimension_type
@@ -142,7 +142,7 @@
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
 
 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scale, (long)(class))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scaled_system, (class)(class))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scaled_base_unit, (class)(class))
 
 #endif
 
@@ -156,7 +156,7 @@
 };
 
 template<class S, class Scale>
-struct unscale<scaled_system<S, Scale> > {
+struct unscale<scaled_base_unit<S, Scale> > {
     typedef S type;
 };
 
@@ -177,7 +177,7 @@
 };
 
 template<class S, class Scale>
-struct get_scale_list<scaled_system<S, Scale> > {
+struct get_scale_list<scaled_base_unit<S, Scale> > {
     typedef dimension_list<scale_list_dim<Scale>, dimensionless_type> type;
 };
 
@@ -273,7 +273,7 @@
 };
 
 template<class Tag>
-struct less_impl<boost::units::scaled_system_tag, Tag> {
+struct less_impl<boost::units::scaled_base_unit_tag, Tag> {
     template<class T0, class T1>
     struct apply : mpl::bool_<
         ((mpl::less<typename T0::system_type, T1>::value) ||
@@ -282,7 +282,7 @@
 };
 
 template<class Tag>
-struct less_impl<Tag, boost::units::scaled_system_tag> {
+struct less_impl<Tag, boost::units::scaled_base_unit_tag> {
     template<class T0, class T1>
     struct apply : mpl::bool_<
         ((mpl::less<T0, typename T1::system_type>::value) ||
@@ -291,7 +291,7 @@
 };
 
 template<>
-struct less_impl<boost::units::scaled_system_tag, boost::units::scaled_system_tag> {
+struct less_impl<boost::units::scaled_base_unit_tag, boost::units::scaled_base_unit_tag> {
     template<class T0, class T1>
     struct apply : mpl::bool_<
         ((mpl::less<typename T0::system_type, typename T1::system_type>::value) ||

Deleted: sandbox/units/boost/units/experimental/scaled_system.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/scaled_system.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
+++ (empty file)
@@ -1,309 +0,0 @@
-// 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_SCALED_SYSTEM_HPP_INCLUDED
-#define BOOST_UNITS_SCALED_SYSTEM_HPP_INCLUDED
-
-#include <string>
-
-//#include <boost/units/io.hpp>
-//#include <boost/units/conversion.hpp>
-#include <boost/units/dimension.hpp>
-#include <boost/units/config.hpp>
-#include <boost/units/experimental/one.hpp>
-#include <boost/units/static_rational.hpp>
-#include <boost/units/experimental/static_rational_power.hpp>
-
-namespace boost {
-
-namespace units {
-
-template<class Dimensions, class System>
-class unit;
-
-template<class T>
-struct heterogeneous_system;
-
-template<class T, class D>
-struct heterogeneous_system_pair;
-
-template<class T, class E>
-struct heterogeneous_system_dim;
-
-template<long Base, class Exponent>
-struct scale {
- enum { base = Base };
- typedef Exponent exponent;
- typedef double value_type;
- static value_type value() { return(detail::static_rational_power<Exponent>(static_cast<double>(base))); }
-};
-
-template<long Base>
-struct scale<Base, static_rational<0> > {
- enum { base = Base };
- typedef static_rational<0> exponent;
- typedef one value_type;
- static one value() { return(one()); }
- static std::string name_prefix() { return(std::string()); }
- static std::string symbol_prefix() { return(std::string()); }
-};
-
-#define BOOST_UNITS_SCALE_SPECIALIZATION(base_,exponent_,val,name,symbol) \
-template<> \
-struct scale<base_, exponent_> \
-{ \
- enum { base = base_ }; \
- typedef exponent_ exponent; \
- typedef double value_type; \
- static value_type value() { return(val); } \
- static std::string name_prefix() { return(#name); } \
- static std::string symbol_prefix() { return(#symbol); } \
-}
-
-#define BOOST_UNITS_SCALE_DEF(exponent,name,symbol) \
- BOOST_UNITS_SCALE_SPECIALIZATION(10,static_rational<exponent>,1e ## exponent, name, symbol)
-
-BOOST_UNITS_SCALE_DEF(-24, yocto, y);
-BOOST_UNITS_SCALE_DEF(-21, zepto, z);
-BOOST_UNITS_SCALE_DEF(-18, atto, a);
-BOOST_UNITS_SCALE_DEF(-15, femto, f);
-BOOST_UNITS_SCALE_DEF(-12, pico, p);
-BOOST_UNITS_SCALE_DEF(-9, nano, n);
-BOOST_UNITS_SCALE_DEF(-6, micro, u);
-BOOST_UNITS_SCALE_DEF(-3, milli, m);
-BOOST_UNITS_SCALE_DEF(-2, centi, c);
-BOOST_UNITS_SCALE_DEF(-1, deci, d);
-
-BOOST_UNITS_SCALE_DEF(1, deka, da);
-BOOST_UNITS_SCALE_DEF(2, hecto, h);
-BOOST_UNITS_SCALE_DEF(3, kilo, k);
-BOOST_UNITS_SCALE_DEF(6, mega, M);
-BOOST_UNITS_SCALE_DEF(9, giga, G);
-BOOST_UNITS_SCALE_DEF(12, tera, T);
-BOOST_UNITS_SCALE_DEF(15, peta, P);
-BOOST_UNITS_SCALE_DEF(18, exa, E);
-BOOST_UNITS_SCALE_DEF(21, zetta, Z);
-BOOST_UNITS_SCALE_DEF(24, yotta, Y);
-
-BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<10>, 1024.0, kibi, Ki);
-BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<20>, 1048576.0, mebi, Mi);
-BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<30>, 1073741824.0, gibi, Gi);
-BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<40>, 1099511627776.0, tebi, Ti);
-BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<50>, 1125899906842624.0, pebi, Pi);
-BOOST_UNITS_SCALE_SPECIALIZATION(2, static_rational<60>, 1152921504606846976.0, exbi, Ei);
-
-#undef BOOST_UNITS_SCALE_DEF
-#undef BOOST_UNITS_SCALE_SPECIALIZATION
-
-struct scaled_system_tag {};
-
-template<class S, class Scale>
-struct scaled_system
-{
- typedef scaled_system type;
- typedef scaled_system_tag tag;
- typedef S system_type;
- typedef Scale scale_type;
- typedef typename S::dimension_type dimension_type;
- typedef unit<
- dimension_type,
- heterogeneous_system<
- heterogeneous_system_pair<
- dimension_list<
- heterogeneous_system_dim<scaled_system,static_rational<1> >,
- dimensionless_type
- >,
- dimension_type
- >
- >
- > unit_type;
- typedef typename S::dimension_type dimension_type;
- static std::string symbol() {
- return(Scale::symbol_prefix() + S::symbol());
- }
- static std::string name() {
- return(Scale::name_prefix() + S::name());
- }
-};
-
-} // namespace units
-
-} // namespace boost
-
-#ifdef BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scale, (long)(class))
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scaled_system, (class)(class))
-
-#endif
-
-namespace boost {
-
-namespace units {
-
-template<class T>
-struct unscale {
- typedef T type;
-};
-
-template<class S, class Scale>
-struct unscale<scaled_system<S, Scale> > {
- typedef S type;
-};
-
-template<class D, class S>
-class unit;
-
-template<class D, class S>
-struct unscale<unit<D, S> > {
- typedef unit<D, typename unscale<S>::type> type;
-};
-
-template<class Scale>
-struct scale_list_dim;
-
-template<class T>
-struct get_scale_list {
- typedef dimensionless_type type;
-};
-
-template<class S, class Scale>
-struct get_scale_list<scaled_system<S, Scale> > {
- typedef dimension_list<scale_list_dim<Scale>, dimensionless_type> type;
-};
-
-template<class D, class S>
-struct get_scale_list<unit<D, S> > {
- typedef typename get_scale_list<S>::type type;
-};
-
-struct scale_dim_tag {};
-
-template<class Scale>
-struct scale_list_dim : Scale {
- typedef scale_dim_tag tag;
- typedef scale_list_dim type;
-};
-
-namespace detail {
-
-template<class Scale1, class Scale2>
-struct less<scale_list_dim<Scale1>, scale_list_dim<Scale2> > : mpl::bool_<((Scale1::base) < (Scale2::base))> {
-};
-
-template<int N>
-struct eval_scale_list_impl {
- template<class Begin>
- struct apply {
- typedef typename eval_scale_list_impl<N-1>::template apply<typename mpl::next<Begin>::type> next_iteration;
- typedef typename multiply_typeof_helper<typename next_iteration::type, typename mpl::deref<Begin>::type::value_type>::type type;
- static type value() {
- return(next_iteration::value() * mpl::deref<Begin>::type::value());
- }
- };
-};
-
-template<>
-struct eval_scale_list_impl<0> {
- template<class Begin>
- struct apply {
- typedef one type;
- static type value() {
- return(type());
- }
- };
-};
-
-}
-
-template<class T>
-struct eval_scale_list : detail::eval_scale_list_impl<mpl::size<T>::value>::template apply<typename mpl::begin<T>::type> {
-};
-
-} // namespace units
-
-namespace mpl {
-
-template<>
-struct plus_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag> {
- template<class T0, class T1>
- struct apply {
- typedef boost::units::scale_list_dim<
- boost::units::scale<
- (T0::base),
- typename mpl::plus<typename T0::exponent, typename T1::exponent>::type
- >
- > type;
- };
-};
-
-template<>
-struct negate_impl<boost::units::scale_dim_tag> {
- template<class T0>
- struct apply {
- typedef boost::units::scale_list_dim<
- boost::units::scale<
- (T0::base),
- typename mpl::negate<typename T0::exponent>::type
- >
- > type;
- };
-};
-
-template<>
-struct times_impl<boost::units::scale_dim_tag, boost::units::detail::static_rational_tag> {
- template<class T0, class T1>
- struct apply {
- typedef boost::units::scale_list_dim<
- boost::units::scale<
- (T0::base),
- typename mpl::times<typename T0::exponent, T1>::type
- >
- > type;
- };
-};
-
-template<class Tag>
-struct less_impl<boost::units::scaled_system_tag, Tag> {
- template<class T0, class T1>
- struct apply : mpl::bool_<
- ((mpl::less<typename T0::system_type, T1>::value) ||
- ((boost::is_same<typename T0::system_type, T1>::value) && ((T0::scale_type::exponent::Numerator) < 0)))> {
- };
-};
-
-template<class Tag>
-struct less_impl<Tag, boost::units::scaled_system_tag> {
- template<class T0, class T1>
- struct apply : mpl::bool_<
- ((mpl::less<T0, typename T1::system_type>::value) ||
- ((boost::is_same<T0, typename T1::system_type>::value) && ((T1::scale_type::exponent::Numerator) > 0)))> {
- };
-};
-
-template<>
-struct less_impl<boost::units::scaled_system_tag, boost::units::scaled_system_tag> {
- template<class T0, class T1>
- struct apply : mpl::bool_<
- ((mpl::less<typename T0::system_type, typename T1::system_type>::value) ||
- ((boost::is_same<typename T0::system_type, typename T1::system_type>::value) &&
- (((T0::scale_type::base) < (T1::scale_type::base)) ||
- (((T0::scale_type::base) == (T1::scale_type::base)) &&
- (mpl::less<typename T0::scale_type::exponent,typename T1::scale_type::exponent>::value)))))> {
- };
-};
-
-} // namespace mpl
-
-} // namespace boost
-
-#endif

Modified: sandbox/units/libs/units/test/test_header.hpp
==============================================================================
--- sandbox/units/libs/units/test/test_header.hpp (original)
+++ sandbox/units/libs/units/test/test_header.hpp 2007-05-25 14:41:11 EDT (Fri, 25 May 2007)
@@ -61,9 +61,9 @@
 typedef derived_dimension<length_dim,3>::type volume_type;
 
 /// placeholder class defining test unit system
-struct length_unit : base_unit<length_unit, length_type, 1> {};
-struct mass_unit : base_unit<mass_unit, mass_type, 2> {};
-struct time_unit : base_unit<time_unit, time_type, 3> {};
+struct length_unit : base_unit<length_unit, length_type, 4> {};
+struct mass_unit : base_unit<mass_unit, mass_type, 5> {};
+struct time_unit : base_unit<time_unit, time_type, 6> {};
 
 typedef make_system<length_unit, mass_unit, time_unit>::type system;
 


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