Boost logo

Boost-Commit :

From: steven_watanabe_at_[hidden]
Date: 2007-05-28 16:18:54


Author: steven_watanabe
Date: 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
New Revision: 4337
URL: http://svn.boost.org/trac/boost/changeset/4337

Log:
Cleaned up directories

Added:
   sandbox/units/boost/units/base_unit.hpp
      - copied unchanged from r4254, /sandbox/units/boost/units/experimental/base_unit.hpp
   sandbox/units/boost/units/conversion.hpp
      - copied, changed from r4254, /sandbox/units/boost/units/experimental/conversion.hpp
   sandbox/units/boost/units/detail/linear_algebra.hpp
      - copied, changed from r4254, /sandbox/units/boost/units/experimental/linear_algebra.hpp
   sandbox/units/boost/units/detail/one.hpp
      - copied, changed from r4228, /sandbox/units/boost/units/experimental/one.hpp
   sandbox/units/boost/units/detail/sort.hpp
      - copied, changed from r4228, /sandbox/units/boost/units/experimental/sort.hpp
   sandbox/units/boost/units/detail/static_rational_power.hpp
      - copied, changed from r4228, /sandbox/units/boost/units/experimental/static_rational_power.hpp
   sandbox/units/boost/units/heterogeneous_system.hpp
      - copied, changed from r4254, /sandbox/units/boost/units/experimental/heterogeneous_system.hpp
   sandbox/units/boost/units/io.hpp
      - copied, changed from r4335, /sandbox/units/boost/units/experimental/io.hpp
   sandbox/units/boost/units/make_system.hpp
      - copied, changed from r4254, /sandbox/units/boost/units/experimental/make_system.hpp
   sandbox/units/boost/units/scaled_base_unit.hpp
      - copied, changed from r4254, /sandbox/units/boost/units/experimental/scaled_base_unit.hpp
   sandbox/units/boost/units/systems/base_units.hpp
      - copied, changed from r4254, /sandbox/units/boost/units/experimental/fundamental_units.hpp
Removed:
   sandbox/units/boost/units/detail/conversion_impl.hpp
   sandbox/units/boost/units/detail/io_impl.hpp
   sandbox/units/boost/units/detail/system_impl.hpp
   sandbox/units/boost/units/experimental/base_unit.hpp
   sandbox/units/boost/units/experimental/conversion.hpp
   sandbox/units/boost/units/experimental/experimental.hpp
   sandbox/units/boost/units/experimental/fundamental_units.hpp
   sandbox/units/boost/units/experimental/heterogeneous_system.hpp
   sandbox/units/boost/units/experimental/io.hpp
   sandbox/units/boost/units/experimental/linear_algebra.hpp
   sandbox/units/boost/units/experimental/make_system.hpp
   sandbox/units/boost/units/experimental/one.hpp
   sandbox/units/boost/units/experimental/scaled_base_unit.hpp
   sandbox/units/boost/units/experimental/sort.hpp
   sandbox/units/boost/units/experimental/static_rational_power.hpp
   sandbox/units/boost/units/system.hpp
   sandbox/units/boost/units/systems/angles/
   sandbox/units/boost/units/systems/conversions/
Text files modified:
   sandbox/units/boost/units/absolute.hpp | 2
   sandbox/units/boost/units/conversion.hpp | 23 ++++++--
   sandbox/units/boost/units/detail/linear_algebra.hpp | 6 +-
   sandbox/units/boost/units/detail/one.hpp | 4
   sandbox/units/boost/units/detail/sort.hpp | 4
   sandbox/units/boost/units/detail/static_rational_power.hpp | 6 +-
   sandbox/units/boost/units/detail/unit_impl.hpp | 4 -
   sandbox/units/boost/units/heterogeneous_system.hpp | 8 +-
   sandbox/units/boost/units/io.hpp | 23 ++++++++-
   sandbox/units/boost/units/make_system.hpp | 4
   sandbox/units/boost/units/scaled_base_unit.hpp | 6 -
   sandbox/units/boost/units/systems/abstract.hpp | 37 --------------
   sandbox/units/boost/units/systems/angle/degrees.hpp | 30 -----------
   sandbox/units/boost/units/systems/angle/gradians.hpp | 37 --------------
   sandbox/units/boost/units/systems/base_units.hpp | 7 +-
   sandbox/units/boost/units/systems/cgs/base.hpp | 52 ---------------------
   sandbox/units/boost/units/systems/physical_units.hpp | 4 -
   sandbox/units/boost/units/systems/si/base.hpp | 94 ---------------------------------------
   sandbox/units/boost/units/unit.hpp | 5 -
   sandbox/units/libs/units/example/test_system.hpp | 7 --
   sandbox/units/libs/units/example/unit_example_16.cpp | 1
   sandbox/units/libs/units/example/unit_example_21.cpp | 4
   sandbox/units/libs/units/test/test_header.hpp | 4
   23 files changed, 79 insertions(+), 293 deletions(-)

Modified: sandbox/units/boost/units/absolute.hpp
==============================================================================
--- sandbox/units/boost/units/absolute.hpp (original)
+++ sandbox/units/boost/units/absolute.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -77,4 +77,4 @@
 
 } // namespace boost
 
-#endif // BOOST_UNITS_ABSOLUTE_HPP
\ No newline at end of file
+#endif // BOOST_UNITS_ABSOLUTE_HPP

Copied: sandbox/units/boost/units/conversion.hpp (from r4254, /sandbox/units/boost/units/experimental/conversion.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/conversion.hpp (original)
+++ sandbox/units/boost/units/conversion.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_EXPERIMENTAL_CONVERSION_HPP
-#define BOOST_UNITS_EXPERIMENTAL_CONVERSION_HPP
+#ifndef BOOST_UNITS_CONVERSION_HPP
+#define BOOST_UNITS_CONVERSION_HPP
 
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/size.hpp>
@@ -18,11 +18,11 @@
 #include <boost/mpl/deref.hpp>
 #include <boost/mpl/divides.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>
-#include <boost/units/experimental/static_rational_power.hpp>
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/make_system.hpp>
+#include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/detail/one.hpp>
+#include <boost/units/detail/static_rational_power.hpp>
 
 namespace boost {
 
@@ -216,6 +216,15 @@
     }
 };
 
+template<class Y,class FromUnit,class ToUnit>
+inline
+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();
+}
+
 } //namespace units
 
 } // namespace boost

Deleted: sandbox/units/boost/units/detail/conversion_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/conversion_impl.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,825 +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_CONVERSION_IMPL_HPP
-#define BOOST_UNITS_CONVERSION_IMPL_HPP
-
-#include <cmath>
-
-#include <boost/type_traits/is_base_and_derived.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/deref.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/size.hpp>
-
-#include <boost/units/static_rational.hpp>
-#include <boost/units/experimental/one.hpp>
-
-namespace boost {
-
-namespace units {
-
-// tag class to indicate that implicit conversions are allowed
-struct implicitly_convertible { };
-
-// tag class to indicate that conversion is trivial
-struct trivial_conversion
-{
- typedef one type;
- static one value() { return one(); }
-};
-
-struct identity_conversion :
- public trivial_conversion, implicitly_convertible
-{ };
-
-struct trivial_inverse_conversion { };
-
-struct undefined_conversion { };
-
-template<class Converter>
-struct reverse_conversion :
- public mpl::if_<is_base_and_derived<implicitly_convertible, Converter>, implicitly_convertible, undefined_conversion>::type
-{
- typedef typename Converter::type type;
-
- static type value()
- {
- return(one()/Converter::value());
- }
-};
-
-template<class Dimension, class Tag1, class Tag2>
-struct base_unit_converter :
- public mpl::eval_if<is_same<Tag1, Tag2>,
- mpl::identity<identity_conversion>,
- mpl::if_<
- is_base_and_derived<
- trivial_inverse_conversion,
- base_unit_converter<Dimension,Tag2,Tag1>
- >,
- reverse_conversion<base_unit_converter<Dimension,Tag2,Tag1> >,
- undefined_conversion
- >
- >::type
-{ };
-
-template<class Tag,class System1,class System2>
-struct base_unit_is_implicitly_convertible :
- public boost::is_base_and_derived<implicitly_convertible,
- base_unit_converter<Tag,System1,System2> >
-{ };
-
-namespace detail {
-
-template<class R, class Y>
-struct static_rational_power_impl
-{
- static Y apply(const Y& y)
- {
- return(std::pow(y, value<Y>(R())));
- }
-};
-
-template<integer_type N, bool = (N % 2 == 0)>
-struct static_int_power_impl;
-
-template<integer_type N>
-struct static_int_power_impl<N, true>
-{
- template<class Y, class R>
- static Y apply(const Y& y, const R& r) {
- const Y square = y * y;
- return(static_int_power_impl<(N >> 1)>::apply(square, r));
- }
-};
-
-template<integer_type N>
-struct static_int_power_impl<N, false>
-{
- template<class Y, class R>
- static Y apply(const Y& y, const R& r)
- {
- const Y square = y * y;
- return(static_int_power_impl<(N >> 1)>::apply(square, y * r));
- }
-};
-
-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>
- static Y apply(const Y&, const R& r)
- {
- return(r);
- }
-};
-
-template<int N, bool = (N < 0)>
-struct static_int_power_sign_impl;
-
-template<int N>
-struct static_int_power_sign_impl<N, false>
-{
- template<class Y>
- static Y apply(const Y& y)
- {
- return(static_int_power_impl<N>::apply(y, one()));
- }
-};
-
-template<int N>
-struct static_int_power_sign_impl<N, true>
-{
- template<class Y>
- static Y apply(const Y& y)
- {
- return(one()/static_int_power_impl<-N>::apply(y, one()));
- }
-};
-
-template<integer_type N, class Y>
-struct static_rational_power_impl<static_rational<N>, Y>
-{
- static Y apply(const Y& y)
- {
- return(static_int_power_sign_impl<N>::apply(y));
- }
-};
-
-template<class R, class Y>
-Y static_rational_power(const Y& y)
-{
- return(detail::static_rational_power_impl<R, Y>::apply(y));
-}
-
-// convert between homogeneous systems
-template<int N>
-struct quantity_conversion_homo_to_homo_impl
-{
- template<class Begin, class system1_type, class system2_type>
- struct apply
- {
- typedef typename detail::get_tag<typename mpl::deref<Begin>::type>::type dim_tag_type;
- typedef typename detail::get_value<typename mpl::deref<Begin>::type>::type value_type;
-
- typedef typename detail::get_system_tag_of_dim<system1_type,dim_tag_type>::type system1_tag_type;
- typedef typename detail::get_system_tag_of_dim<system2_type,dim_tag_type>::type system2_tag_type;
-
- typedef base_unit_converter<dim_tag_type,system1_tag_type,system2_tag_type> buc_t;
- typedef typename mpl::next<Begin>::type next;
-
- typedef typename quantity_conversion_homo_to_homo_impl<N - 1>::template
- apply<next, system1_type, system2_type> next_iteration;
-
- typedef typename multiply_typeof_helper<typename buc_t::type,
- typename next_iteration::type>::type type;
-
- static type value()
- {
- return(
- static_rational_power<value_type>(buc_t::value()) *
- next_iteration::value()
- );
- }
- };
-};
-
-template<>
-struct quantity_conversion_homo_to_homo_impl<0>
-{
- template<class Begin, class system1_type, class system2_type>
- struct apply
- {
- typedef one type;
- static one value()
- {
- return(one());
- }
- };
-};
-
-// convert between homogeneous and heterogeneous systems
-template<int N>
-struct quantity_conversion_homo_to_hetero_impl
-{
- template<class Begin, class system1_type>
- struct apply
- {
- typedef homogeneous_system<typename detail::get_tag<typename mpl::deref<Begin>::type>::type> system2_type;
- typedef typename detail::get_value<typename mpl::deref<Begin>::type>::type value_type;
-
- typedef typename mpl::next<Begin>::type next;
- typedef typename mpl::begin<value_type>::type begin;
-
- typedef typename quantity_conversion_homo_to_homo_impl<mpl::size<value_type>::value>::template
- apply<begin, system1_type, system2_type> convert_system;
-
- typedef typename quantity_conversion_homo_to_hetero_impl<N - 1>::template
- apply<next, system1_type> next_iteration;
-
- typedef typename multiply_typeof_helper<typename convert_system::type,
- typename next_iteration::type>::type type;
-
- static type value()
- {
- return(
- convert_system::value() *
- next_iteration::value()
- );
- }
- };
-};
-
-template<>
-struct quantity_conversion_homo_to_hetero_impl<0>
-{
- template<class Begin, class system2_type>
- struct apply
- {
- typedef one type;
- static one value()
- {
- return(one());
- }
- };
-};
-
-// convert between heterogeneous and homogeneous systems
-template<int N>
-struct quantity_conversion_hetero_to_homo_impl
-{
- template<class Begin, class system2_type>
- struct apply
- {
- typedef homogeneous_system<typename detail::get_tag<typename mpl::deref<Begin>::type>::type> system1_type;
- typedef typename detail::get_value<typename mpl::deref<Begin>::type>::type value_type;
-
- typedef typename mpl::next<Begin>::type next;
- typedef typename mpl::begin<value_type>::type begin;
-
- typedef typename quantity_conversion_homo_to_homo_impl<mpl::size<value_type>::value>::template
- apply<begin, system1_type, system2_type> convert_system;
-
- typedef typename quantity_conversion_hetero_to_homo_impl<N - 1>::template
- apply<next, system2_type> next_iteration;
-
- typedef typename multiply_typeof_helper<typename convert_system::type,
- typename next_iteration::type>::type type;
-
- static type value()
- {
- return(
- convert_system::value() *
- next_iteration::value()
- );
- }
- };
-};
-
-template<>
-struct quantity_conversion_hetero_to_homo_impl<0>
-{
- template<class Begin, class system1_type>
- struct apply
- {
- typedef one type;
- static one value()
- {
- return(one());
- }
- };
-};
-
-struct heterogeneous_system_by_dimension_dim_tag {};
-
-// the hardest case: heterogeneous->heterogeneous
-template<class Tag, class Value>
-struct heterogeneous_system_by_dimension_dim
-{
- typedef heterogeneous_system_by_dimension_dim type;
- typedef heterogeneous_system_by_dimension_dim_tag tag;
- typedef Tag tag_type;
- typedef Value value_type;
-};
-
-template<class T1, class V1, class T2, class V2>
-struct less<heterogeneous_system_by_dimension_dim<T1, V1>, heterogeneous_system_by_dimension_dim<T2, V2> >
- : mpl::less<T1, T2>
-{ };
-
-template<class Tag, class L>
-struct is_empty_dim<heterogeneous_system_by_dimension_dim<Tag, L> > :
- boost::mpl::false_
-{ };
-
-template<class Tag>
-struct is_empty_dim<heterogeneous_system_by_dimension_dim<Tag, dimensionless_type> > :
- boost::mpl::true_
-{ };
-
-} // namespace detail
-
-} // namespace units
-
-namespace mpl {
-
-template<>
-struct plus_impl<
- boost::units::detail::heterogeneous_system_by_dimension_dim_tag,
- boost::units::detail::heterogeneous_system_by_dimension_dim_tag
->
-{
- template<class T0, class T1>
- struct apply {
- BOOST_STATIC_ASSERT((boost::is_same<typename T0::tag_type, typename T1::tag_type>::value == true));
- typedef boost::units::detail::heterogeneous_system_by_dimension_dim<
- typename T0::tag_type,
- typename boost::units::detail::merge_dimensions<
- typename T0::value_type,
- typename T1::value_type
- >::type
- > type;
- };
-};
-
-template<>
-struct negate_impl<boost::units::detail::heterogeneous_system_by_dimension_dim_tag>
-{
- template<class T0>
- struct apply {
- typedef typename boost::units::detail::static_inverse_impl<mpl::size<typename T0::value_type>::value>::template apply<
- typename mpl::begin<typename T0::value_type>::type
- >::type inverse;
- typedef boost::units::detail::heterogeneous_system_by_dimension_dim<typename T0::tag_type, inverse> type;
- };
-};
-
-} // namespace mpl
-
-namespace units {
-
-namespace detail {
-
-struct heterogeneous_system_by_dimension_value_tag {};
-
-template<class SystemTag, class Value>
-struct heterogeneous_system_by_dimension_value
-{
- typedef heterogeneous_system_by_dimension_value type;
- typedef heterogeneous_system_by_dimension_value_tag tag;
- typedef SystemTag tag_type;
- typedef Value value_type;
-};
-
-template<class T1, class V1, class T2, class V2>
-struct less<heterogeneous_system_by_dimension_value<T1, V1>, heterogeneous_system_by_dimension_value<T2, V2> >
- : mpl::less<T1, T2>
-{ };
-
-template<class Tag, class L>
-struct is_empty_dim<heterogeneous_system_by_dimension_value<Tag, L> > :
- boost::mpl::false_
-{ };
-
-template<class Tag>
-struct is_empty_dim<heterogeneous_system_by_dimension_value<Tag, dimensionless_type> > :
- boost::mpl::true_
-{ };
-
-} // namespace detail
-
-} // namespace units
-
-namespace mpl {
-
-template<>
-struct plus_impl<
- boost::units::detail::heterogeneous_system_by_dimension_value_tag,
- boost::units::detail::heterogeneous_system_by_dimension_value_tag
->
-{
- template<class T0, class T1>
- struct apply {
- BOOST_STATIC_ASSERT((boost::is_same<typename T0::tag_type, typename T1::tag_type>::value == true));
- typedef boost::units::detail::heterogeneous_system_by_dimension_value<
- typename T0::tag_type,
- typename plus<typename T0::value_type, typename T1::value_type>::type
- > type;
- };
-};
-
-template<>
-struct negate_impl<boost::units::detail::heterogeneous_system_by_dimension_value_tag>
-{
- template<class T0>
- struct apply {
- typedef boost::units::detail::heterogeneous_system_by_dimension_value<typename T0::tag_type, typename negate<typename T0::value_type>::type> type;
- };
-};
-
-} // namespace mpl
-
-namespace units {
-
-namespace detail {
-
-template<int N>
-struct convert_dimension_to_system_dimension_pairs_impl
-{
- template<class Begin, class System>
- struct apply
- {
- typedef typename mpl::deref<Begin>::type dim;
- typedef typename mpl::push_front<
- typename convert_dimension_to_system_dimension_pairs_impl<N-1>::template
- apply<typename mpl::next<Begin>::type, System>::type,
- heterogeneous_system_by_dimension_dim<
- typename dim::tag_type,
- typename mpl::push_front<dimensionless_type, heterogeneous_system_by_dimension_value<System, typename dim::value_type> >::type
- >
- >::type type;
- };
-};
-template<>
-struct convert_dimension_to_system_dimension_pairs_impl<0>
-{
- template<class Begin, class System>
- struct apply
- {
- typedef dimensionless_type type;
- };
-};
-
-template<int N>
-struct sort_heterogeneous_system_by_dimension_tag_impl
-{
- template<class Begin>
- struct apply
- {
- typedef typename mpl::deref<Begin>::type element;
- typedef typename convert_dimension_to_system_dimension_pairs_impl<mpl::size<typename element::value_type>::value>::template apply<
- typename mpl::begin<typename element::value_type>::type,
- typename element::tag_type
- >::type converted;
- typedef typename detail::merge_dimensions<
- converted,
- typename sort_heterogeneous_system_by_dimension_tag_impl<N - 1>::template apply<typename mpl::next<Begin>::type>::type
- >::type type;
- };
-};
-
-template<>
-struct sort_heterogeneous_system_by_dimension_tag_impl<0>
-{
- template<class Begin>
- struct apply
- {
- typedef dimensionless_type type;
- };
-};
-
-template<class System>
-struct sort_heterogeneous_system_by_dimension_tag
-{
- typedef typename sort_heterogeneous_system_by_dimension_tag_impl<mpl::size<System>::value>::template apply<typename mpl::begin<System>::type>::type type;
-};
-
-//one->many
-template<int N>
-struct fundamental_dimension_convert_homo_to_hetero_impl
-{
- template<class Begin, class Tag, class system1_type>
- struct apply
- {
- typedef typename detail::get_tag<typename mpl::deref<Begin>::type>::type system2_type;
- typedef typename detail::get_value<typename mpl::deref<Begin>::type>::type value_type;
-
- typedef typename mpl::next<Begin>::type next;
- typedef typename mpl::begin<value_type>::type begin;
-
- typedef base_unit_converter<Tag, system1_type, system2_type> converter;
-
- 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,
- typename next_iteration::type>::type type;
-
- static type value()
- {
- return (static_rational_power<value_type>(converter::value())*next_iteration::value());
- }
- };
-};
-
-template<>
-struct fundamental_dimension_convert_homo_to_hetero_impl<0>
-{
- template<class Begin, class Tag, class system1_type>
- struct apply
- {
- typedef one type;
- static one value()
- {
- return(one());
- }
- };
-};
-
-//many->one
-template<int N>
-struct fundamental_dimension_convert_hetero_to_homo_impl
-{
- template<class Begin, class Tag, class system2_type>
- struct apply
- {
- typedef typename detail::get_tag<typename mpl::deref<Begin>::type>::type system1_type;
- typedef typename detail::get_value<typename mpl::deref<Begin>::type>::type value_type;
-
- typedef typename mpl::next<Begin>::type next;
- typedef typename mpl::begin<value_type>::type begin;
-
- typedef base_unit_converter<Tag, system1_type, system2_type> converter;
-
- 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,
- typename next_iteration::type>::type type;
-
- static type value()
- {
- return(
- static_rational_power<value_type>(converter::value()) *
- next_iteration::value()
- );
- }
- };
-};
-
-template<>
-struct fundamental_dimension_convert_hetero_to_homo_impl<0>
-{
- template<class Begin, class Tag, class system2_type>
- struct apply
- {
- typedef one type;
- static one value()
- {
- return(one());
- }
- };
-};
-
-template<int N1, int N2>
-struct quantity_conversion_hetero_to_hetero_impl_func;
-
-template<int N2>
-struct quantity_conversion_hetero_to_hetero_impl_func<1, N2>
-{
- template<class Dim1, class Dim2>
- struct 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
- > type;
- };
-};
-template<int N1>
-struct quantity_conversion_hetero_to_hetero_impl_func<N1, 1>
-{
- template<class Dim1, class Dim2>
- struct 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
- > type;
- };
-};
-template<>
-struct quantity_conversion_hetero_to_hetero_impl_func<1, 1>
-{
- template<class Dim1, class Dim2>
- struct apply
- {
- struct type_xxx :
- base_unit_converter<
- typename Dim1::tag_type,
- typename mpl::front<typename Dim1::value_type>::type::tag_type,
- typename mpl::front<typename Dim2::value_type>::type::tag_type
- >
- {
- };
- typedef type_xxx type;
- };
-};
-
-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;
- typedef typename detail::get_value<typename mpl::deref<Begin2>::type>::type value_type2;
-
- typedef typename mpl::next<Begin1>::type next1;
- typedef typename mpl::next<Begin2>::type next2;
-
- typedef typename quantity_conversion_hetero_to_hetero_impl_func<
- mpl::size<value_type1>::value,
- 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<N2 - 1, 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()
- );
- }
- };
-};
-
-// only the source contains the current fundamental dimension
-template<>
-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
- {
- typedef one type;
- static one value()
- {
- return(one());
- }
- };
-};
-
-template<class System1, class System2>
-struct quantity_conversion_hetero_to_hetero
-{
- 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,
- 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()
- {
- return(converter::value());
- }
-};
-
-} // namespace detail
-
-} // namespace units
-
-} // namespace boost
-
-#endif // BOOST_UNITS_CONVERSION_IMPL_HPP

Deleted: sandbox/units/boost/units/detail/io_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/io_impl.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,187 +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_IO_IMPL_HPP
-#define BOOST_UNITS_IO_IMPL_HPP
-
-#include <iosfwd>
-#include <string>
-
-#include <boost/config.hpp>
-
-#include <boost/units/quantity.hpp>
-
-namespace boost {
-
-namespace units {
-
-template<class Tag, class System> struct base_unit_info;
-
-namespace detail {
-
-template<bool positive>
-struct static_rational_print_impl;
-
-template<>
-struct static_rational_print_impl<true>
-{
- template<class Char, class Traits, integer_type N>
- static void apply(std::basic_ostream<Char, Traits>& os,const static_rational<N>&)
- {
- os << N;
- }
-};
-
-template<>
-struct static_rational_print_impl<false>
-{
- template<class Char, class Traits, integer_type N>
- static void apply(std::basic_ostream<Char, Traits>& os,const static_rational<N>&)
- {
-// os << '(' << N << ')';
- os << N;
- }
-};
-
-template<class Os, class Char, class Traits, class Allocator>
-void print_string(Os& os, const std::basic_string<Char, Traits, Allocator>& s)
-{
- os << s.c_str();
-}
-
-template<class Os, class Char>
-void print_string(Os& os, const char* s)
-{
- os << s;
-}
-
-template<int N>
-struct unit_output_helper
-{
- template<class System, class Os, class Begin>
- static void apply(Os& os, Begin)
- {
- typedef typename mpl::deref<Begin>::type D;
- typedef typename detail::get_tag<D>::type dim_tag_type;
- typedef typename detail::get_value<D>::type value_type;
- typedef typename detail::get_system_tag_of_dim<System,dim_tag_type>::type system_tag_type;
-
- typedef base_unit_info<dim_tag_type,system_tag_type> m_type;
-
- detail::print_string(os, m_type::symbol());
-
- if (!boost::is_same<value_type, static_rational<1> >())
- {
- os << '^' << value_type();
- }
-
- os << ' ';
-
- unit_output_helper<N - 1>::template apply<System>(os, typename mpl::next<Begin>::type());
- }
-};
-
-template<>
-struct unit_output_helper<1>
-{
- template<class System, class Os, class Begin>
- static void apply(Os& os, Begin)
- {
- typedef typename mpl::deref<Begin>::type D;
- typedef typename detail::get_tag<D>::type dim_tag_type;
- typedef typename detail::get_value<D>::type value_type;
- typedef typename detail::get_system_tag_of_dim<System,dim_tag_type>::type system_tag_type;
-
- typedef base_unit_info<dim_tag_type,system_tag_type> m_type;
-
- detail::print_string(os, m_type::symbol());
-
- if (!boost::is_same<value_type, static_rational<1> >())
- {
- os << '^' << value_type();
- }
- }
-};
-
-template<>
-struct unit_output_helper<0>
-{
- //should never be called
-};
-
-template<int N>
-struct heterogeneous_unit_output_helper
-{
- template<class Os, class Begin>
- static void apply(Os& os, Begin)
- {
- typedef typename mpl::deref<Begin>::type D;
- typedef homogeneous_system<typename detail::get_tag<D>::type> System;
- typedef typename detail::get_value<D>::type value_type;
-
- typedef typename mpl::begin<value_type>::type begin;
-
- unit_output_helper<mpl::size<value_type>::value>::template apply<System>(os, begin());
-
- os << ' ';
-
- heterogeneous_unit_output_helper<N - 1>::template apply(os, typename mpl::next<Begin>::type());
- }
-};
-
-template<>
-struct heterogeneous_unit_output_helper<1>
-{
- template<class Os, class Begin>
- static void apply(Os& os, Begin)
- {
- typedef typename mpl::deref<Begin>::type D;
- typedef homogeneous_system<typename detail::get_tag<D>::type> System;
- typedef typename detail::get_value<D>::type value_type;
-
- typedef typename mpl::begin<value_type>::type begin;
-
- unit_output_helper<mpl::size<value_type>::value>::template apply<System>(os, begin());
- }
-};
-
-template<>
-struct heterogeneous_unit_output_helper<0>
-{
- //should never be called
-};
-
-template<class Char, class Traits, class System,class Dim>
-void output_impl(std::basic_ostream<Char, Traits>& os,const unit<Dim,System>&)
-{
- unit_output_helper<mpl::size<Dim>::value>::template apply<System>(
- os, typename mpl::begin<Dim>::type());
-}
-
-template<class Char, class Traits, class System,class Dim>
-void output_impl(std::basic_ostream<Char, Traits>& os,const unit<Dim,heterogeneous_system<System> >&)
-{
- heterogeneous_unit_output_helper<mpl::size<typename heterogeneous_system<System>::type>::value>::template apply(
- os, typename mpl::begin<typename heterogeneous_system<System>::type>::type());
-}
-
-template<class Char, class Traits, class System>
-void output_impl(std::basic_ostream<Char, Traits>& os,const unit<dimensionless_type,homogeneous_system<System> >&)
-{
- os << "dimensionless";
-}
-
-} // namespace detail
-
-} // namespace units
-
-} // namespace boost
-
-#endif // BOOST_UNITS_IO_IMPL_HPP

Copied: sandbox/units/boost/units/detail/linear_algebra.hpp (from r4254, /sandbox/units/boost/units/experimental/linear_algebra.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/linear_algebra.hpp (original)
+++ sandbox/units/boost/units/detail/linear_algebra.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_LINEAR_ALGEBRA_HPP
-#define BOOST_UNITS_LINEAR_ALGEBRA_HPP
+#ifndef BOOST_UNITS_DETAIL_LINEAR_ALGEBRA_HPP
+#define BOOST_UNITS_DETAIL_LINEAR_ALGEBRA_HPP
 
 #include <boost/units/static_rational.hpp>
 #include <boost/mpl/list.hpp>
@@ -30,7 +30,7 @@
 #include <boost/mpl/erase.hpp>
 #include <boost/mpl/front.hpp>
 
-#include <boost/units/experimental/sort.hpp>
+#include <boost/units/detail/sort.hpp>
 
 namespace boost {
 

Copied: sandbox/units/boost/units/detail/one.hpp (from r4228, /sandbox/units/boost/units/experimental/one.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/one.hpp (original)
+++ sandbox/units/boost/units/detail/one.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_ONE_HPP
-#define BOOST_UNITS_ONE_HPP
+#ifndef BOOST_UNITS_DETAIL_ONE_HPP
+#define BOOST_UNITS_DETAIL_ONE_HPP
 
 #include <boost/units/operators.hpp>
 

Copied: sandbox/units/boost/units/detail/sort.hpp (from r4228, /sandbox/units/boost/units/experimental/sort.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/sort.hpp (original)
+++ sandbox/units/boost/units/detail/sort.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_EXPERIMENTAL_SORT_HPP_INCLUDED
-#define BOOST_UNITS_EXPERIMENTAL_SORT_HPP_INCLUDED
+#ifndef BOOST_UNITS_DETAIL_SORT_HPP
+#define BOOST_UNITS_DETAIL_SORT_HPP
 
 #include <boost/mpl/size.hpp>
 #include <boost/mpl/begin.hpp>

Copied: sandbox/units/boost/units/detail/static_rational_power.hpp (from r4228, /sandbox/units/boost/units/experimental/static_rational_power.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/static_rational_power.hpp (original)
+++ sandbox/units/boost/units/detail/static_rational_power.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -8,13 +8,13 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_STATIC_RATIONAL_POWER_HPP
-#define BOOST_UNITS_STATIC_RATIONAL_POWER_HPP
+#ifndef BOOST_UNITS_DETAIL_STATIC_RATIONAL_POWER_HPP
+#define BOOST_UNITS_DETAIL_STATIC_RATIONAL_POWER_HPP
 
 #include <cmath>
 
 #include <boost/units/static_rational.hpp>
-#include <boost/units/experimental/one.hpp>
+#include <boost/units/detail/one.hpp>
 
 namespace boost {
 

Deleted: sandbox/units/boost/units/detail/system_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/system_impl.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,177 +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_SYSTEM_IMPL_HPP
-#define BOOST_UNITS_SYSTEM_IMPL_HPP
-
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/bool_fwd.hpp>
-#include <boost/mpl/front.hpp>
-#include <boost/mpl/less.hpp>
-#include <boost/mpl/size.hpp>
-
-#include <boost/units/dim.hpp>
-
-namespace boost {
-
-namespace units {
-
-/// Homogeneous unit system (unit system with all fundamental dimensions
-/// measured in the same system of units).
-template<class S>
-struct homogeneous_system
-{
- typedef S type;
-};
-
-/// Heterogeneous unit system (unit system in which fundamental dimensions
-/// may be measured in different systems of units and fundamental dimensions
-/// may be repeated for multiple systems).
-template<class S>
-struct heterogeneous_system
-{
- typedef typename S::system_type type;
- typedef typename S::dimension_type dimension;
-};
-
-template<class UnitList, class Dimensions>
-struct heterogeneous_system_pair
-{
- typedef UnitList system_type;
- typedef Dimensions dimension_type;
-};
-
-namespace detail {
-
-struct heterogeneous_system_element_tag {};
-
-}
-
-template<class System, class Dimensions>
-struct heterogeneous_system_element
-{
- typedef heterogeneous_system_element type;
- typedef detail::heterogeneous_system_element_tag tag;
- typedef System tag_type;
- typedef Dimensions value_type;
-};
-
-}
-
-}
-
-#if BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::homogeneous_system, 1)
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system, 1)
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system_pair, 2)
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system_element, 2)
-
-#endif
-
-namespace boost {
-
-namespace units {
-
-namespace detail {
-
-template<class S,class DT> struct get_system_tag_of_dim;
-
-template<class S,class DT>
-struct get_system_tag_of_dim< homogeneous_system<S>,DT >
-{
- // this will need to check if DT is in the system
- typedef typename homogeneous_system<S>::type type;
-};
-
-template<class T1,class V1,class T2,class V2>
-struct less< heterogeneous_system_element<T1,V1>,heterogeneous_system_element<T2,V2> >
-{
- typedef typename boost::mpl::less<T1,T2>::type type;
-
- static const bool value = boost::is_same<type,boost::mpl::true_>::value;
-};
-
-template<class System, class L>
-struct is_empty_dim<heterogeneous_system_element<System, L> > :
- boost::mpl::false_
-{ };
-
-template<class System>
-struct is_empty_dim<heterogeneous_system_element<System, dimensionless_type> > :
- boost::mpl::true_
-{ };
-
-template<class System, class Dimension>
-struct check_system : mpl::true_
-{
-};
-
-template<class System, class Dim1, class Dim2>
-struct check_system<heterogeneous_system<heterogeneous_system_pair<System, Dim1> >, Dim2> : mpl::false_
-{
-};
-
-template<class System, class Dim1>
-struct check_system<heterogeneous_system<heterogeneous_system_pair<System, Dim1> >, Dim1> : mpl::true_
-{
-};
-
-template<bool one_system>
-struct make_system;
-
-template<>
-struct make_system<false>
-{
- template<class L, class Dimension>
- struct apply
- {
- typedef heterogeneous_system<heterogeneous_system_pair<L, Dimension> > type;
- };
-};
-
-template<>
-struct make_system<true>
-{
- template<class L, class Dimension>
- struct apply
- {
- typedef homogeneous_system<typename detail::get_tag<typename mpl::front<L>::type>::type> type;
- };
-};
-
-template<class S1, class S2>
-struct multiply_systems
-{
- typedef typename detail::merge_dimensions<typename S1::type, typename S2::type>::type type1;
- typedef typename mpl::times<typename S1::dimension, typename S2::dimension>::type dimension;
- typedef typename make_system<mpl::size<type1>::value == 1>::template apply<type1,dimension>::type type;
-};
-
-template<class S1, class S2>
-struct divide_systems
-{
- typedef typename S2::type s2;
- typedef typename detail::static_inverse_impl<mpl::size<s2>::value>::template
- apply<typename mpl::begin<s2>::type>::type inverse;
- typedef typename detail::merge_dimensions<typename S1::type, inverse>::type type1;
- typedef typename mpl::divides<typename S1::dimension, typename S2::dimension>::type dimension;
- typedef typename make_system<mpl::size<type1>::value == 1>::template apply<type1, dimension>::type type;
-};
-
-} // namespace detail
-
-} // namespace units
-
-} // namespace boost
-
-#endif // BOOST_UNITS_SYSTEM_IMPL_HPP

Modified: sandbox/units/boost/units/detail/unit_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/unit_impl.hpp (original)
+++ sandbox/units/boost/units/detail/unit_impl.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -16,10 +16,8 @@
 #include <boost/mpl/bool.hpp>
 
 #include <boost/units/operators.hpp>
-#include <boost/units/system.hpp>
-//#include <boost/units/detail/conversion_impl.hpp>
 
-#include <boost/units/experimental/heterogeneous_system.hpp>
+#include <boost/units/heterogeneous_system.hpp>
 
 //namespace boost {
 //

Deleted: sandbox/units/boost/units/experimental/base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/base_unit.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,88 +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_BASE_UNIT_HPP
-#define BOOST_UNITS_BASE_UNIT_HPP
-
-#include <boost/units/config.hpp>
-#include <boost/units/dim.hpp>
-#include <boost/units/dimension_list.hpp>
-#include <boost/units/static_rational.hpp>
-#include <boost/units/units_fwd.hpp>
-
-#include <boost/units/detail/prevent_ordinal_redefinition_impl.hpp>
-
-namespace boost {
-
-namespace units {
-
-/// This must be in namespace boost::units so that ADL
-/// will work with friend functions defined inline.
-/// Base dimensions and base units are independent.
-/// INTERNAL ONLY
-template<long N> struct base_unit_ordinal { };
-
-/// INTERNAL ONLY
-template<class T, long N> struct base_unit_pair { };
-
-/// Defines a base dimension. To define a unit you need to provide
-/// the derived class (CRTP), a dimension list and a unique integer.
-/// struct my_unit : boost::units::base_unit<my_dimension, length_type, 1> {};
-/// It is designed so that you will get an error message if you try
-/// to use the same value in multiple definitions.
-template<class Derived,
- class Dim,
- long N,
- class = typename detail::ordinal_has_already_been_defined<
- 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>
-{
- public:
- typedef base_unit this_type;
- //typedef mpl::long_<N> value;
- typedef Dim dimension_type;
-
- typedef Derived type;
-
- typedef unit<
- Dim,
- heterogeneous_system<
- heterogeneous_system_pair<
- dimension_list<
- heterogeneous_system_dim<Derived,static_rational<1> >,
- dimensionless_type
- >,
- Dim
- >
- >
- > unit_type;
-
- private:
- /// Register this ordinal
- /// INTERNAL ONLY
- friend detail::yes
- 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_unit_is_registered(const units::base_unit_pair<Derived, N>&)
- { return(detail::yes()); }
-};
-
-} // namespace units
-
-} // namespace boost
-
-#endif // BOOST_UNITS_BASE_UNIT_HPP

Deleted: sandbox/units/boost/units/experimental/conversion.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/conversion.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,223 +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_EXPERIMENTAL_CONVERSION_HPP
-#define BOOST_UNITS_EXPERIMENTAL_CONVERSION_HPP
-
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
-#include <boost/mpl/divides.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>
-#include <boost/units/experimental/static_rational_power.hpp>
-
-namespace boost {
-
-namespace units {
-
-template<class Dimension, class System>
-class unit;
-
-template<class Unit, class T>
-class quantity;
-
-template<class From, class To>
-struct conversion_helper;
-
-template<class Source, class Destination>
-struct select_base_unit_converter {
- typedef Source source_type;
- typedef Destination destination_type;
-};
-
-template<class Source, class Destination>
-struct base_unit_converter {
- typedef select_base_unit_converter<typename unscale<Source>::type, typename unscale<Destination>::type> selector;
- typedef typename selector::source_type source_type;
- typedef typename selector::destination_type destination_type;
- typedef base_unit_converter<source_type, destination_type> converter;
- 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 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());
- }
-};
-
-template<bool try_inverse, bool trivial>
-struct inverse_base_unit_converter_impl;
-
-template<>
-struct inverse_base_unit_converter_impl<false, false> {
- template<class Source, class Destination>
- struct apply {
- typedef select_base_unit_converter<typename unscale<Source>::type, typename unscale<typename Destination::unit_type>::type> selector;
- typedef typename selector::source_type source_type;
- typedef typename selector::destination_type destination_type;
- typedef base_unit_converter<source_type, destination_type> converter;
- 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 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());
- }
- };
-};
-
-template<>
-struct inverse_base_unit_converter_impl<true, false> {
- template<class Source, class Destination>
- struct apply {
- typedef base_unit_converter<Destination, typename Source::unit_type> inverse;
- typedef typename inverse::type type;
- static type value() {
- return(1/inverse::value());
- }
- };
-};
-
-template<bool dummy>
-struct inverse_base_unit_converter_impl<dummy, true> {
- template<class Source, class Destination>
- struct apply {
- typedef one type;
- static type value() { return(type()); }
- };
-};
-
-template<class Source, class Dest>
-struct use_inverse_conversion {
- typedef select_base_unit_converter<typename unscale<Source>::type, typename unscale<typename Dest::unit_type>::type> selector;
- enum { value = (boost::is_same<Source, typename selector::source_type>::value) &&
- (boost::is_same<typename Dest::unit_type, typename selector::destination_type>::value) };
-};
-
-template<class Source, class Dest>
-struct base_unit_converter<
- Source,
- unit<
- typename Source::dimension_type,
- heterogeneous_system<
- heterogeneous_system_pair<
- dimension_list<heterogeneous_system_dim<Dest, static_rational<1> >, dimensionless_type>,
- typename Source::dimension_type
- >
- >
- >
-> : inverse_base_unit_converter_impl<use_inverse_conversion<Source, Dest>::value, boost::is_same<Source, Dest>::value>::template apply<Source, Dest> {
-};
-
-#define BOOST_UNITS_DEFINE_CONVERSION(Source, Destination, type_, value_)\
-namespace boost {\
-namespace units {\
-template<>\
-struct select_base_unit_converter<unscale<Source>::type,unscale<reduce_unit<Destination>::type>::type> {\
- typedef Source source_type;\
- typedef Destination destination_type;\
-};\
-template<>\
-struct base_unit_converter<Source, reduce_unit<Destination>::type> {\
- typedef type_ type;\
- static type value() { return(value_); }\
-};\
-}\
-}\
-void boost_units_require_semicolon()
-
-namespace detail {
-
-template<int N>
-struct conversion_impl {
- template<class Begin, class DestinationSystem>
- struct apply {
- typedef typename conversion_impl<N-1>::template apply<
- typename mpl::next<Begin>::type,
- DestinationSystem
- > next_iteration;
- typedef typename mpl::deref<Begin>::type unit_pair;
- typedef typename unit_pair::tag_type unit;
- typedef typename unit::dimension_type dimensions;
- typedef typename reduce_unit<units::unit<dimensions, DestinationSystem> >::type reduced_unit;
- typedef base_unit_converter<unit, reduced_unit> converter;
- typedef typename multiply_typeof_helper<typename converter::type, typename next_iteration::type>::type type;
- static type value() { return(static_rational_power<typename unit_pair::value_type>(converter::value()) * next_iteration::value()); }
- };
-};
-
-template<>
-struct conversion_impl<0> {
- template<class Begin, class DestinationSystem>
- struct apply {
- typedef one type;
- static type value() { return(one()); }
- };
-};
-
-} // namespace detail
-
-template<class D, class L1, class T1, class L2, class T2>
-struct conversion_helper<quantity<unit<D, homogeneous_system<L1> >, T1>, quantity<unit<D, homogeneous_system<L2> >, T2> > {
- typedef quantity<unit<D, homogeneous_system<L2> >, T2> destination_type;
- typedef typename reduce_unit<unit<D, homogeneous_system<L1> > >::type source_unit;
- typedef typename source_unit::system_type::type unit_list;
- static destination_type convert(const quantity<unit<D, homogeneous_system<L1> >, T1>& source) {
- return(destination_type::from_value(source.value() *
- detail::conversion_impl<mpl::size<unit_list>::value>::template apply<
- typename mpl::begin<unit_list>::type,
- homogeneous_system<L2>
- >::value()
- ));
- }
-};
-
-template<class D, class L1, class T1, class L2, class T2>
-struct conversion_helper<quantity<unit<D, heterogeneous_system<L1> >, T1>, quantity<unit<D, homogeneous_system<L2> >, T2> > {
- typedef quantity<unit<D, homogeneous_system<L2> >, T2> destination_type;
- static destination_type convert(const quantity<unit<D, heterogeneous_system<L1> >, T1>& source) {
- return(destination_type::from_value(source.value() *
- detail::conversion_impl<mpl::size<typename L1::type>::value>::template apply<
- typename mpl::begin<typename L1::type>::type,
- homogeneous_system<L2>
- >::value()
- ));
- }
-};
-
-// There is no simple algorithm for doing this conversion
-// other than just defining it as the reverse of the
-// heterogeneous->homogeneous case
-template<class D, class L1, class T1, class L2, class T2>
-struct conversion_helper<quantity<unit<D, homogeneous_system<L1> >, T1>, quantity<unit<D, heterogeneous_system<L2> >, T2> > {
- typedef quantity<unit<D, heterogeneous_system<L2> >, T2> destination_type;
- static destination_type convert(const quantity<unit<D, homogeneous_system<L1> >, T1>& source) {
- return(destination_type::from_value(source.value() /
- detail::conversion_impl<mpl::size<typename L2::type>::value>::template apply<
- typename mpl::begin<typename L2::type>::type,
- homogeneous_system<L1>
- >::value()
- ));
- }
-};
-
-} //namespace units
-
-} // namespace boost
-
-#endif

Deleted: sandbox/units/boost/units/experimental/experimental.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/experimental.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,192 +0,0 @@
-#include <boost/mpl/list.hpp>
-#include <boost/mpl/vector.hpp>
-
-#include <boost/units/base_dimension.hpp>
-#include <boost/units/derived_dimension.hpp>
-#include <boost/units/io.hpp>
-#include <boost/units/ordinal.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/static_constant.hpp>
-#include <boost/units/unit.hpp>
-
-struct length_base_dim : boost::units::base_dimension<length_base_dim, 1> { }; ///> base dimension of length
-struct mass_base_dim : boost::units::base_dimension<mass_base_dim,2> { }; ///> base dimension of mass
-struct time_base_dim : boost::units::base_dimension<time_base_dim,3> { }; ///> base dimension of time
-struct current_base_dim : boost::units::base_dimension<current_base_dim,4> { }; ///> base dimension of current
-struct temperature_base_dim : boost::units::base_dimension<temperature_base_dim,5> { }; ///> base dimension of temperature
-struct amount_base_dim : boost::units::base_dimension<amount_base_dim,6> { }; ///> base dimension of amount
-struct luminous_intensity_base_dim : boost::units::base_dimension<luminous_intensity_base_dim,7> { }; ///> base dimension of luminous intensity
-
-struct charge_base_dim : boost::units::base_dimension<charge_base_dim,8> { }; ///> base dimension of charge
-
-struct velocity_base_dim : boost::units::base_dimension<velocity_base_dim,9> { }; ///> base dimension of velocity
-struct action_base_dim : boost::units::base_dimension<action_base_dim,10> { }; ///> base dimension of action
-
-typedef derived_dimension<length_base_dim,1,time_base_dim,-1>::type velocity_derived_dim;
-typedef derived_dimension<mass_base_dim,1,
- length_base_dim,-1,
- time_base_dim,-2>::type pressure_derived_dim;
-
-struct meter_base_unit : boost::units::base_unit<length_base_dim,1> { };
-struct kilogram_base_unit : boost::units::base_unit<mass_base_dim,2> { };
-struct second_base_unit : boost::units::base_unit<time_base_dim,3> { };
-struct ampere_base_unit : boost::units::base_unit<current_base_dim,4> { };
-struct kelvin_base_unit : boost::units::base_unit<temperature_base_dim,5> { };
-struct mole_base_unit : boost::units::base_unit<amount_base_dim,6> { };
-struct candela_base_unit : boost::units::base_unit<luminous_intensity_base_dim,7> { };
-
-struct centimeter_base_unit : boost::units::base_unit<length_base_dim,8> { };
-struct gram_base_unit : boost::units::base_unit<mass_base_dim,9> { };
-
-struct nu_velocity_base_unit : boost::units::base_unit<velocity_base_dim,10> { };
-struct nu_action_base_unit : boost::units::base_unit<action_base_dim,11> { };
-struct nu_mass_base_unit : boost::units::base_unit<mass_base_dim,12> { };
-
-struct mmHg_base_unit : boost::units::base_unit<pressure_derived_dim,13> { };
-
-namespace cgs {
-
-typedef make_system<centimeter_base_unit,
- gram_base_unit,
- second_base_unit>::type system;
-
-typedef unit<length_base_dim,system> length;
-typedef unit<mass_base_dim,system> mass;
-typedef unit<time_base_dim,system> time;
-
-typedef unit<velocity_derived_dim,system> velocity;
-typedef unit<pressure_derived_dim,system> pressure;
-
-} // namespace cgs
-
-namespace mks {
-
-typedef make_system<meter_base_unit,
- kilogram_base_unit,
- second_base_unit>::type system;
-
-typedef unit<length_base_dim,system> length;
-typedef unit<mass_base_dim,system> mass;
-typedef unit<time_base_dim,system> time;
-
-typedef unit<velocity_derived_dim,system> velocity;
-typedef unit<pressure_derived_dim,system> pressure;
-
-} // namespace mks
-
-namespace si {
-
-typedef make_system<meter_base_unit,
- kilogram_base_unit,
- second_base_unit,
- ampere_base_unit,
- kelvin_base_unit,
- mole_base_unit,
- candela_base_unit>::type system;
-
-typedef unit<length_base_dim,system> length;
-typedef unit<mass_base_dim,system> mass;
-typedef unit<time_base_dim,system> time;
-typedef unit<current_base_dim,system> current;
-typedef unit<temperature_base_dim,system> temperature;
-typedef unit<amount_base_dim,system> amount;
-typedef unit<luminous_intensity_base_dim,system> luminous_intensity;
-
-typedef unit<velocity_derived_dim,system> velocity;
-typedef unit<pressure_derived_dim,system> pressure;
-
-} // namespace si
-
-namespace nu {
-
-typedef make_system<nu_velocity_base_unit,
- nu_action_base_unit,
- nu_mass_base_unit>::type system;
-
-typedef unit<velocity_base_dim,system> velocity;
-typedef unit<action_base_dim,system> action;
-typedef unit<mass_base_dim,system> mass;
-
-typedef derived_dimension<velocity_base_dim,-2,
- action_base_dim,1,
- mass_base_dim,-1>::type time_derived_dim;
-
-typedef unit<time_derived_dim,system> time;
-
-} // namespace nu
-
-namespace my_system {
-
-typedef make_system<mmHg_base_unit>::type system;
-
-typedef unit<pressure_derived_dim,system> pressure;
-
-}
-
-namespace boost {
-
-namespace units {
-
-template<class Dim,class Sys1,class Sys2> struct base_unit_converter<Dim,Sys1,Sys2>;
-
-// implicit base unit conversion
-template<>
-struct base_unit_converter<time_base_dim,cgs::system,si::system> :
- public trivial_conversion,
- public trivial_inverse_conversion
-{
- typedef time_base_dim converted_dimension_type;
-};
-
-// explicit base unit conversion
-template<>
-struct base_unit_converter<length_base_dim,cgs::system,si::system> :
- public trivial_inverse_conversion
-{
- typedef length_base_dim converted_dimension_type;
- typedef double type;
-
- static type value() { return(.01); }
-};
-
-// explicit derived unit conversion
-template<>
-struct base_unit_converter<pressure_derived_dim,si::system,my_system::system> :
- public trivial_inverse_conversion
-{
- typedef pressure_derived_dim converted_dimension_type;
- typedef double type;
-
- static type value()
- {
- return 760.0/1.01325e5;
- }
-};
-
-// explicit conversion between two units with different but equivalent dimensions
-template<>
-struct base_unit_converter<velocity_base_dim,nu::system,si::system>
-{
- typedef velocity_derived_dim converted_dimension_type;
- typedef double type;
-
- static type value()
- {
- return 2.998e8;
- }
-};
-
-} // namespace units
-
-} // namespace boost
-
-int main()
-{
- const quantity<si::pressure> p(quantity<my_system::pressure>(1.0));
-
- // uses direct unit_converter
- const quantity<si::velocity> v(quantity<nu::velocity>(1.0));
- const quantity<nu::velocity> v(quantity<si::velocity>(1.0));
-
- return 0;
-}

Deleted: sandbox/units/boost/units/experimental/fundamental_units.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/fundamental_units.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,153 +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_OTHER_UNITS_HPP_INCLUDED
-#define BOOST_UNITS_OTHER_UNITS_HPP_INCLUDED
-
-#include <string>
-
-#include <boost/units/systems/physical_units.hpp>
-#include <boost/units/experimental/base_unit.hpp>
-#include <boost/units/experimental/scaled_base_unit.hpp>
-
-namespace boost {
-
-namespace units {
-
-struct meter_tag : public base_unit<meter_tag, length_type, -20> {
- static std::string name() { return("meter"); }
- static std::string symbol() { return("m"); }
-};
-struct foot_tag : public base_unit<foot_tag, length_type, -19> {
- static std::string name() { return("foot"); }
- static std::string symbol() { return("ft"); }
-};
-struct inch_tag : public base_unit<inch_tag, length_type, -18> {
- static std::string name() { return("inch"); }
- static std::string symbol() { return("in"); }
-};
-struct yard_tag : public base_unit<yard_tag, length_type, -17> {
- static std::string name() { return("yard"); }
- static std::string symbol() { return("yd"); }
-};
-struct mile_tag : public base_unit<mile_tag, length_type, -16> {
- static std::string name() { return("mile"); }
- static std::string symbol() { return("mi"); }
-};
-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_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"); }
- static std::string symbol() { return("s"); }
-};
-struct minute_tag : public base_unit<minute_tag, time_type, -13> {
- static std::string name() { return("minute"); }
- static std::string symbol() { return("min"); }
-};
-struct hour_tag : public base_unit<hour_tag, time_type, -12> {
- static std::string name() { return("foot"); }
- static std::string symbol() { return("ft"); }
-};
-
-struct ampere_tag : public base_unit<ampere_tag, current_type, -11> {
- static std::string name() { return("ampere"); }
- static std::string symbol() { return("A"); }
-};
-struct biot_tag : public base_unit<biot_tag, current_type, -10> {
- static std::string name() { return("biot"); }
- //static std::string symbol() { return(""); }
-};
-
-struct kelvin_tag : public base_unit<kelvin_tag, temperature_type, -9> {
- static std::string name() { return("kelvin"); }
- static std::string symbol() { return("K"); }
-};
-struct fahrenheit_tag : public base_unit<fahrenheit_tag, temperature_type, -8> {
- static std::string name() { return("fahrenheit"); }
- static std::string symbol() { return("F"); }
-};
-
-struct mole_tag : public base_unit<mole_tag, amount_type, -7> {
- static std::string name() { return("mole"); }
- static std::string symbol() { return("mol"); }
-};
-
-struct candela_tag : public base_unit<candela_tag, luminous_intensity_type, -6> {
- static std::string name() { return("candela"); }
- static std::string symbol() { return("cd"); }
-};
-
-struct radian_tag : public base_unit<radian_tag, plane_angle_type, -5> {
- static std::string name() { return("radian"); }
- static std::string symbol() { return("rad"); }
-};
-struct degree_tag : public base_unit<degree_tag, plane_angle_type, -4> {
- static std::string name() { return("degree"); }
- static std::string symbol() { return("deg"); }
-};
-struct gradian_tag : public base_unit<gradian_tag, plane_angle_type, -3> {
- static std::string name() { return("gradian"); }
- static std::string symbol() { return("grad"); }
-};
-
-struct steradian_tag : public base_unit<steradian_tag, solid_angle_type, -2> {
- static std::string name() { return("steradian"); }
- static std::string symbol() { return("sr"); }
-};
-
-}
-
-}
-
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::radian_tag, boost::units::degree_tag::unit_type, double, 180/3.14159265358979323846);
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::radian_tag, boost::units::gradian_tag::unit_type, double, 200/3.14159265358979323846);
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::degree_tag, boost::units::gradian_tag::unit_type, double, 10/9.);
-
-#ifdef BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::meter_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::foot_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::inch_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::yard_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::mile_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::gram_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::second_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::minute_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::hour_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::ampere_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::biot_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::kelvin_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::fahrenheit_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::mole_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::candela_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::radian_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::degree_tag)
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::gradian_tag)
-
-BOOST_TYPEOF_REGISTER_TYPE(boost::units::steradian_tag)
-
-#endif
-
-#endif

Deleted: sandbox/units/boost/units/experimental/heterogeneous_system.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/heterogeneous_system.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,305 +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_EXPERIMENTAL_HETEROGENEOUS_SYSTEM_HPP
-#define BOOST_UNITS_EXPERIMENTAL_HETEROGENEOUS_SYSTEM_HPP
-
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/plus.hpp>
-#include <boost/mpl/times.hpp>
-#include <boost/mpl/divides.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
-
-#include <boost/units/static_rational.hpp>
-#include <boost/units/dimension.hpp>
-#include <boost/units/detail/push_front_if.hpp>
-#include <boost/units/experimental/scaled_base_unit.hpp>
-#include <boost/units/experimental/linear_algebra.hpp>
-
-namespace boost {
-
-namespace units {
-
-namespace detail {
-
-// A normal system is a sorted list of base units.
-// A heterogeneous system is a sorted list of base unit/exponent pairs.
-// As long as we don't need to convert heterogeneous systems
-// directly everything is cool
-
-template<class T>
-struct is_zero : mpl::false_ {};
-
-template<>
-struct is_zero<static_rational<0> > : mpl::true_ {};
-
-}
-
-template<class L, class Dimensions>
-struct heterogeneous_system_pair {
- typedef L type;
- typedef Dimensions dimensions;
-};
-
-template<class T>
-struct heterogeneous_system : T {
-};
-
-struct heterogeneous_system_dim_tag {};
-
-template<class Unit, class Exponent>
-struct heterogeneous_system_dim {
- typedef heterogeneous_system_dim_tag tag;
- typedef heterogeneous_system_dim type;
- typedef Unit tag_type;
- typedef Exponent value_type;
-};
-
-namespace detail {
-
-template<class Unit1, class Exponent1, class Unit2, class Exponent2>
-struct less<heterogeneous_system_dim<Unit1,Exponent1>,heterogeneous_system_dim<Unit2,Exponent2> > :
- mpl::less<Unit1, Unit2> {
-};
-
-template<class Unit1, class Exponent1>
-struct is_empty_dim<heterogeneous_system_dim<Unit1,Exponent1> > : detail::is_zero<Exponent1> {};
-
-} // namespace detail
-
-} // namespace units
-
-namespace mpl {
-
-template<>
-struct plus_impl<boost::units::heterogeneous_system_dim_tag, boost::units::heterogeneous_system_dim_tag> {
- template<class T0, class T1>
- struct apply {
- typedef boost::units::heterogeneous_system_dim<
- typename T0::tag_type,
- typename mpl::plus<typename T0::value_type,typename T1::value_type>::type
- > type;
- };
-};
-
-template<>
-struct times_impl<boost::units::heterogeneous_system_dim_tag, boost::units::detail::static_rational_tag> {
- template<class T0, class T1>
- struct apply {
- typedef boost::units::heterogeneous_system_dim<
- typename T0::tag_type,
- typename mpl::times<typename T0::value_type,T1>::type
- > type;
- };
-};
-
-template<>
-struct negate_impl<boost::units::heterogeneous_system_dim_tag> {
- template<class T>
- struct apply {
- typedef boost::units::heterogeneous_system_dim<typename T::tag_type, typename mpl::negate<typename T::value_type>::type> type;
- };
-};
-
-} // namespace mpl
-
-namespace units {
-
-namespace detail {
-
-template<int N>
-struct make_heterogeneous_system_impl {
- template<class UnitsBegin, class ExponentsBegin>
- struct apply {
- typedef typename push_front_if<!(is_zero<typename mpl::deref<ExponentsBegin>::type>::value)>::template apply<
- typename make_heterogeneous_system_impl<N-1>::template apply<
- typename mpl::next<UnitsBegin>::type,
- typename mpl::next<ExponentsBegin>::type
- >::type,
- heterogeneous_system_dim<typename mpl::deref<UnitsBegin>::type, typename mpl::deref<ExponentsBegin>::type>
- >::type type;
- };
-};
-
-template<>
-struct make_heterogeneous_system_impl<0> {
- template<class UnitsBegin, class ExponentsBegin>
- struct apply {
- typedef dimensionless_type type;
- };
-};
-
-template<class Dimensions, class System>
-struct make_heterogeneous_system {
- typedef typename calculate_base_unit_exponents<typename System::type, Dimensions>::type exponents;
- typedef typename make_heterogeneous_system_impl<mpl::size<typename System::type>::value>::template apply<
- typename mpl::begin<typename System::type>::type,
- typename mpl::begin<exponents>::type
- >::type unit_list;
- typedef heterogeneous_system<heterogeneous_system_pair<unit_list,Dimensions> > type;
-};
-
-template<class Dimensions, class T>
-struct make_heterogeneous_system<Dimensions, heterogeneous_system<T> > {
- typedef heterogeneous_system<T> type;
-};
-
-template<class T0, class T1>
-struct multiply_systems {
- typedef heterogeneous_system<
- heterogeneous_system_pair<
- typename mpl::times<typename T0::type, typename T1::type>::type,
- typename mpl::times<typename T0::dimensions, typename T1::dimensions>::type
- >
- > type;
-};
-
-template<class T0, class T1>
-struct divide_systems {
- typedef heterogeneous_system<
- heterogeneous_system_pair<
- typename mpl::divides<typename T0::type, typename T1::type>::type,
- typename mpl::divides<typename T0::dimensions, typename T1::dimensions>::type
- >
- > type;
-};
-
-} // namespace detail
-
-template<class S, long N, long D>
-struct static_power<heterogeneous_system<S>, static_rational<N,D> > {
- typedef heterogeneous_system<
- heterogeneous_system_pair<
- typename static_power<typename S::type, static_rational<N,D> >::type,
- typename static_power<typename S::dimensions, static_rational<N,D> >::type
- >
- > type;
-};
-
-template<class S, long N, long D>
-struct static_root<heterogeneous_system<S>, static_rational<N,D> > {
- typedef heterogeneous_system<
- heterogeneous_system_pair<
- typename static_root<typename S::type, static_rational<N,D> >::type,
- typename static_root<typename S::dimensions, static_rational<N,D> >::type
- >
- > type;
-};
-
-template<class Unit>
-struct reduce_unit {
- typedef unit<
- typename Unit::dimension_type,
- typename detail::make_heterogeneous_system<
- typename Unit::dimension_type,
- typename Unit::system_type
- >::type
- > type;
-};
-
-namespace detail {
-
-template<int N>
-struct unscale_heterogeneous_system_impl {
- template<class Begin>
- struct apply {
- typedef typename mpl::push_front<
- typename unscale_heterogeneous_system_impl<N-1>::template apply<
- typename mpl::next<Begin>::type
- >::type,
- typename unscale<typename mpl::deref<Begin>::type>::type
- >::type type;
- };
-};
-
-template<>
-struct unscale_heterogeneous_system_impl<0> {
- template<class Begin>
- struct apply {
- typedef dimensionless_type type;
- };
-};
-
-}
-
-template<class T>
-struct unscale<heterogeneous_system<T> > {
- typedef heterogeneous_system<
- heterogeneous_system_pair<
- typename detail::unscale_heterogeneous_system_impl<
- mpl::size<typename T::type>::value
- >::template apply<
- typename mpl::begin<typename T::type>::type
- >::type,
- typename T::dimensions
- >
- > type;
-};
-
-template<class Unit, class Exponent>
-struct unscale<heterogeneous_system_dim<Unit, Exponent> > {
- typedef heterogeneous_system_dim<typename unscale<Unit>::type, Exponent> type;
-};
-
-namespace detail {
-
-template<int N>
-struct get_scale_list_of_heterogeneous_system_impl {
- template<class Begin>
- struct apply {
- typedef typename mpl::times<
- typename get_scale_list_of_heterogeneous_system_impl<N-1>::template apply<
- typename mpl::next<Begin>::type
- >::type,
- typename get_scale_list<typename mpl::deref<Begin>::type>::type
- >::type type;
- };
-};
-
-template<>
-struct get_scale_list_of_heterogeneous_system_impl<0> {
- template<class Begin>
- struct apply {
- typedef dimensionless_type type;
- };
-};
-
-} // namespace detail
-
-template<class T>
-struct get_scale_list<heterogeneous_system<T> > {
- typedef typename detail::get_scale_list_of_heterogeneous_system_impl<
- mpl::size<typename T::type>::value
- >::template apply<typename T::type>::type type;
-};
-
-template<class Unit, class Exponent>
-struct get_scale_list<heterogeneous_system_dim<Unit, Exponent> > {
- typedef typename static_power<typename get_scale_list<Unit>::type, Exponent>::type type;
-};
-
-namespace detail {
-
-template<class System, class Dimension>
-struct check_system : mpl::false_ {};
-
-template<class System, class Dimension>
-struct check_system<heterogeneous_system<heterogeneous_system_pair<System, Dimension> >, Dimension> : mpl::true_ {};
-
-} // namespace detail
-
-} // namespace units
-
-} // namespace boost
-
-#endif

Deleted: sandbox/units/boost/units/experimental/io.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/io.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,140 +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_EXPERIMENTAL_IO_HPP
-#define BOOST_UNITS_EXPERIMENTAL_IO_HPP
-
-#include <string>
-#include <iosfwd>
-
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
-
-#include <boost/units/unit.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/experimental/heterogeneous_system.hpp>
-
-namespace boost {
-
-namespace units {
-
-/// Write integral-valued @c static_rational to @c std::basic_ostream.
-template<class Char, class Traits, integer_type N>
-inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os,const static_rational<N>&)
-{
- os << N;
- return os;
-}
-
-/// Write @c static_rational to @c std::basic_ostream.
-template<class Char, class Traits, integer_type N, integer_type D>
-inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os,const static_rational<N, D>&)
-{
- os << '(' << N << '/' << D << ')';
- return os;
-}
-
-template<class T>
-struct heterogeneous_system;
-
-template<class T>
-struct base_unit_info {
- static std::string name() {
- return(T::name());
- }
- static std::string symbol() {
- return(T::symbol());
- }
-};
-
-namespace detail {
-
-template<class T>
-const T& adapt_for_print(const T& t) {
- return(t);
-}
-
-template<class Char, class Traits, class Allocator>
-const Char* adapt_for_print(const std::basic_string<Char, Traits, Allocator>& s) {
- return(s.c_str());
-}
-
-template<class T, class Os>
-void print_base_unit(Os& os, const T&) {
- os << (adapt_for_print)(base_unit_info<typename T::tag_type>::symbol()) << '^' << typename T::value_type();
-}
-
-template<class Unit, class Os>
-void print_base_unit(Os& os, const heterogeneous_system_dim<Unit, static_rational<1> >&) {
- os << (adapt_for_print)(base_unit_info<Unit>::symbol());
-}
-
-template<int N>
-struct print_impl {
- template<class Begin, class Os>
- struct apply {
- typedef typename print_impl<N-1>::template apply<typename mpl::next<Begin>::type, Os> next;
- static void value(Os& os) {
- (print_base_unit)(os, typename mpl::deref<Begin>::type());
- os << ' ';
- next::value(os);
- }
- };
-};
-
-template<>
-struct print_impl<1> {
- template<class Begin, class Os>
- struct apply {
- static void value(Os& os) {
- (print_base_unit)(os, typename mpl::deref<Begin>::type());
- };
- };
-};
-
-template<>
-struct print_impl<0> {
- template<class Begin, class Os>
- struct apply {
- static void value(Os& os) {
- os << "dimensionless";
- }
- };
-};
-
-} // namespace detail
-
-template<class Char, class Traits, class Dimension, class System>
-std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>&) {
- os << typename reduce_unit<unit<Dimension, System> >::type();
- return(os);
-}
-
-template<class Char, class Traits, class Dimension, class System>
-std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, heterogeneous_system<System> >&) {
- detail::print_impl<mpl::size<typename System::type>::value>::template apply<
- typename mpl::begin<typename System::type>::type,
- std::basic_ostream<Char, Traits> >::value(os);
- return(os);
-}
-
-template<class Char, class Traits, class Unit, class T>
-std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const quantity<Unit, T>& q) {
- os << q.value() << ' ' << Unit();
- return(os);
-}
-
-} // namespace units
-
-} // namespace boost
-
-#endif

Deleted: sandbox/units/boost/units/experimental/linear_algebra.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/linear_algebra.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,1053 +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_LINEAR_ALGEBRA_HPP
-#define BOOST_UNITS_LINEAR_ALGEBRA_HPP
-
-#include <boost/units/static_rational.hpp>
-#include <boost/mpl/list.hpp>
-#include <boost/mpl/push_front.hpp>
-#include <boost/mpl/pop_front.hpp>
-#include <boost/mpl/deref.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/arithmetic.hpp>
-#include <boost/mpl/sort.hpp>
-#include <boost/mpl/front_inserter.hpp>
-#include <boost/mpl/set.hpp>
-#include <boost/mpl/insert.hpp>
-#include <boost/mpl/greater.hpp>
-#include <boost/mpl/reverse.hpp>
-#include <boost/mpl/advance.hpp>
-#include <boost/mpl/erase.hpp>
-#include <boost/mpl/front.hpp>
-
-#include <boost/units/experimental/sort.hpp>
-
-namespace boost {
-
-namespace units {
-
-namespace detail {
-
-// typedef list<rational> equation;
-
-template<int N>
-struct eliminate_from_pair_of_equations_impl;
-
-template<class E1, class E2>
-struct eliminate_from_pair_of_equations;
-
-template<int N>
-struct elimination_impl;
-
-template<bool is_zero, bool element_is_last>
-struct elimination_skip_leading_zeros_impl;
-
-template<class Equation, class Vars>
-struct substitute;
-
-template<int N>
-struct substitute_impl;
-
-template<bool is_end>
-struct solve_impl;
-
-template<class T>
-struct solve;
-
-template<int N>
-struct check_extra_equations_impl;
-
-template<int N>
-struct normalize_units_impl;
-
-struct inconsistant {};
-
-// eliminate_from_pair_of_equations takes a pair of
-// equations and eliminates the first variable.
-//
-// equation eliminate_from_pair_of_equations(equation l1, equation l2) {
-// rational x1 = l1.front();
-// rational x2 = l2.front();
-// return(transform(pop_front(l1), pop_front(l2), _1 * x2 - _2 * x1));
-// }
-
-template<int N>
-struct eliminate_from_pair_of_equations_impl {
- template<class Begin1, class Begin2, class X1, class X2>
- struct apply {
- typedef typename mpl::push_front<
- typename eliminate_from_pair_of_equations_impl<N - 1>::template apply<
- typename mpl::next<Begin1>::type,
- typename mpl::next<Begin2>::type,
- X1,
- X2
- >::type,
- typename mpl::minus<
- typename mpl::times<typename mpl::deref<Begin1>::type, X2>::type,
- typename mpl::times<typename mpl::deref<Begin2>::type, X1>::type
- >::type
- >::type type;
- };
-};
-
-template<>
-struct eliminate_from_pair_of_equations_impl<0> {
- template<class Begin1, class Begin2, class X1, class X2>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-template<class E1, class E2>
-struct eliminate_from_pair_of_equations {
- typedef typename mpl::begin<E1>::type begin1;
- typedef typename mpl::begin<E2>::type begin2;
- typedef typename eliminate_from_pair_of_equations_impl<mpl::size<E1>::value - 1>::template apply<
- typename mpl::next<begin1>::type,
- typename mpl::next<begin2>::type,
- typename mpl::deref<begin1>::type,
- typename mpl::deref<begin2>::type
- >::type type;
-};
-
-// Eliminates the first variable from a list of equations
-// returns inconsistant if all its coefficients are 0. Otherwise
-// recursively calls solve to find the remaining variables
-//
-// list<rational> eliminate(list<equation> system) {
-// list<equation> result;
-// equation eliminate_against = null;
-// for_each(equation e : system) {
-// if(eliminate_against == null) {
-// if(e.front() == 0) {
-// result = push_front(result, pop_front(e));
-// } else {
-// eliminate_against = e;
-// }
-// } else {
-// result = push_back(result, eliminate_from_pair_of_equations(e,eliminate_against));
-// }
-// }
-// if(eliminate_against == null) {
-// return(inconsistant);
-// } else {
-// list<rational> solution = solve(result);
-// return(push_front(solution, substitute(eliminate_against,solution)));
-// }
-// }
-
-template<int N>
-struct elimination_impl {
- template<class Begin, class Prev, class L>
- struct apply {
- typedef typename mpl::push_front<
- typename elimination_impl<N-1>::template apply<typename mpl::next<Begin>::type, Prev, L>::type,
- typename eliminate_from_pair_of_equations<typename mpl::deref<Begin>::type,Prev>::type
- >::type type;
- };
-};
-
-template<>
-struct elimination_impl<0> {
- template<class Begin, class Prev, class L>
- struct apply {
- typedef L type;
- };
-};
-
-template<>
-struct elimination_skip_leading_zeros_impl<true, true> {
- template<class Begin, int N, class L>
- struct apply {
- typedef inconsistant type;
- };
-};
-
-template<>
-struct elimination_skip_leading_zeros_impl<true, false> {
- template<class Begin, int N, class L>
- struct apply {
- typedef typename mpl::next<Begin>::type next;
- typedef typename elimination_skip_leading_zeros_impl<
- boost::is_same<
- typename mpl::deref<
- typename mpl::begin<typename mpl::deref<next>::type>::type
- >::type,
- static_rational<0>
- >::value,
- N == 2
- >::template apply<
- next,
- N-1,
- typename mpl::push_front<
- L,
- typename mpl::pop_front<typename mpl::deref<Begin>::type>::type
- >::type
- >::type type;
- };
-};
-
-template<class S>
-struct combine_solutions {
- template<class Iterator>
- struct apply {
- typedef typename substitute<typename mpl::deref<Iterator>::type, S>::type x;
- typedef typename mpl::push_front<S, x>::type type;
- };
-};
-
-template<>
-struct combine_solutions<inconsistant> {
- template<class Iterator>
- struct apply {
- typedef inconsistant type;
- };
-};
-
-template<>
-struct elimination_skip_leading_zeros_impl<false, true> {
- template<class Begin, int N, class L>
- struct apply {
- typedef typename elimination_impl<N - 1>::template apply<
- typename mpl::next<Begin>::type,
- typename mpl::deref<Begin>::type,
- L
- >::type list_type;
- typedef typename solve<list_type>::type next;
- typedef typename combine_solutions<next>::template apply<Begin>::type type;
- };
-};
-
-template<>
-struct elimination_skip_leading_zeros_impl<false, false> {
- template<class Begin, int N, class L>
- struct apply {
- typedef typename elimination_impl<N - 1>::template apply<
- typename mpl::next<Begin>::type,
- typename mpl::deref<Begin>::type,
- L
- >::type list_type;
- typedef typename solve<list_type>::type next;
- typedef typename combine_solutions<next>::template apply<Begin>::type type;
- };
-};
-
-// finds the vaue of the first variable given the
-// values of all the other variables.
-//
-// rational substitute(equation e, list<rational> solutions) {
-// rational value = e.back();
-// for_each(rational x : solutions, rational a : pop_front(pop_back(e))) {
-// value -= a * x;
-// }
-// return(e.front() / value);
-// }
-
-template<int N>
-struct substitute_impl {
- template<class Begin1, class Begin2>
- struct apply {
- typedef typename mpl::minus<
- typename substitute_impl<N-1>::template apply<
- typename mpl::next<Begin1>::type,
- typename mpl::next<Begin2>::type
- >::type,
- typename mpl::times<
- typename mpl::deref<Begin1>::type,
- typename mpl::deref<Begin2>::type
- >::type
- >::type type;
- };
-};
-
-template<>
-struct substitute_impl<0> {
- template<class Begin1, class Begin2>
- struct apply {
- typedef typename mpl::deref<Begin1>::type type;
- };
-};
-
-template<class Equation, class Vars>
-struct substitute {
- typedef typename mpl::begin<Equation>::type begin;
- typedef typename mpl::divides<
- typename substitute_impl<mpl::size<Vars>::value>::template apply<
- typename mpl::next<begin>::type,
- typename mpl::begin<Vars>::type
- >::type,
- typename mpl::deref<begin>::type
- >::type type;
-};
-
-template<>
-struct solve_impl<true> {
- template<class T>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-// check_extra_equations verifies that the
-// after all the variables have been eliminated
-// the remaining equations are all 0=0.
-
-template<class T>
-struct check_extra_equations_func {
- template<class Begin, int N>
- struct apply {
- typedef inconsistant type;
- };
-};
-
-template<>
-struct check_extra_equations_func<static_rational<0> > {
- template<class Begin, int N>
- struct apply {
- typedef typename check_extra_equations_impl<N - 1>::template apply<typename mpl::next<Begin>::type>::type type;
- };
-};
-
-template<int N>
-struct check_extra_equations_impl {
- template<class Begin>
- struct apply {
- typedef typename check_extra_equations_func<
- typename mpl::deref<typename mpl::begin<typename mpl::deref<Begin>::type>::type>::type
- >::template apply<Begin, N>::type type;
- };
-};
-
-template<>
-struct check_extra_equations_impl<0> {
- template<class Begin>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-template<bool is_end>
-struct check_extra_equations;
-
-template<>
-struct check_extra_equations<true> {
- template<class T>
- struct apply {
- typedef typename check_extra_equations_impl<mpl::size<T>::value>::template apply<
- typename mpl::begin<T>::type
- >::type type;
- };
-};
-
-template<>
-struct check_extra_equations<false> {
- template<class T>
- struct apply {
- typedef typename mpl::begin<T>::type begin;
- typedef typename elimination_skip_leading_zeros_impl<
- boost::is_same<
- typename mpl::deref<
- typename mpl::begin<typename mpl::deref<begin>::type>::type
- >::type,
- static_rational<0>
- >::value,
- mpl::size<T>::value == 1
- >::template apply<
- begin,
- mpl::size<T>::value,
- mpl::list0<>
- >::type type;
- };
-};
-
-template<>
-struct solve_impl<false> {
- template<class T>
- struct apply {
- typedef typename mpl::begin<T>::type begin;
- typedef typename check_extra_equations<
- mpl::size<typename mpl::deref<begin>::type>::value == 1
- >::template apply<
- T
- >::type type;
- };
-};
-
-// solve takes a list of equations and returns the solutions
-// as a vector. Each equation is interpreted as a sequence
-// of coefficients with the last item being the value e.g.
-// list<1, 2, 3> is 1 * x0 + 2 * x1 = 3
-
-template<class T>
-struct solve {
- typedef typename solve_impl<mpl::size<T>::value == 0>::template apply<T>::type type;
-};
-
-// find_base_dimensions takes a list of
-// base_units and returns a sorted list
-// of all the base_dimensions they use.
-//
-// list<base_dimension> find_base_dimensions(list<base_unit> l) {
-// set<base_dimension> dimensions;
-// for_each(base_unit unit : l) {
-// for_each(dim d : unit.dimension_type) {
-// dimensions = insert(dimensions, d.tag_type);
-// }
-// }
-// return(sort(dimensions, _1 > _2, front_inserter(list<base_dimension>())));
-// }
-
-template<int N>
-struct find_base_dimensions_impl_impl {
- template<class Begin, class S>
- struct apply {
- typedef typename mpl::insert<
- typename find_base_dimensions_impl_impl<N-1>::template apply<
- typename mpl::next<Begin>::type,
- S
- >::type,
- typename mpl::deref<Begin>::type::tag_type
- >::type type;
- };
-};
-
-template<>
-struct find_base_dimensions_impl_impl<0> {
- template<class Begin, class S>
- struct apply {
- typedef S type;
- };
-};
-
-template<int N>
-struct find_base_dimensions_impl {
- template<class Begin>
- struct apply {
- typedef typename find_base_dimensions_impl_impl<mpl::size<typename mpl::deref<Begin>::type::dimension_type>::value>::template apply<
- typename mpl::begin<typename mpl::deref<Begin>::type::dimension_type>::type,
- typename find_base_dimensions_impl<N-1>::template apply<typename mpl::next<Begin>::type>::type
- >::type type;
- };
-};
-
-template<>
-struct find_base_dimensions_impl<0> {
- template<class Begin>
- struct apply {
- typedef mpl::set0<> type;
- };
-};
-
-template<class T>
-struct find_base_dimensions {
- typedef typename bubble_sort<
- typename find_base_dimensions_impl<
- mpl::size<T>::value
- >::template apply<typename mpl::begin<T>::type>::type
- >::type type;
-};
-
-// calculate_base_dimension_coefficients finds
-// the coefficients corresponding to the first
-// base_dimension in each of the dimension_lists.
-// It returns two values. The first result
-// is a list of the coefficients. The second
-// is a list with all the incremented iterators.
-// When we encounter a base_dimension that is
-// missing from a dimension_list, we do not
-// increment the iterator and we set the
-// coefficient to zero.
-
-template<bool has_dimension>
-struct calculate_base_dimension_coefficients_func;
-
-template<>
-struct calculate_base_dimension_coefficients_func<true> {
- template<class T>
- struct apply {
- typedef typename mpl::deref<T>::type::value_type type;
- typedef typename mpl::next<T>::type next;
- };
-};
-
-template<>
-struct calculate_base_dimension_coefficients_func<false> {
- template<class T>
- struct apply {
- typedef static_rational<0> type;
- typedef T next;
- };
-};
-
-// begins_with_dimension returns true iff its first
-// parameter is a valid iterator which yields its
-// second parameter when dereferenced.
-
-template<class Iterator>
-struct begins_with_dimension {
- template<class Dim>
- struct apply :
- boost::is_same<
- Dim,
- typename mpl::deref<Iterator>::type::tag_type
- > {};
-};
-
-template<>
-struct begins_with_dimension<dimensionless_type> {
- template<class Dim>
- struct apply : mpl::false_ {};
-};
-
-template<int N>
-struct calculate_base_dimension_coefficients_impl {
- template<class BaseUnitDimensions,class Dim,class T>
- struct apply {
- typedef typename calculate_base_dimension_coefficients_func<
- begins_with_dimension<typename mpl::deref<BaseUnitDimensions>::type>::template apply<
- Dim
- >::value
- >::template apply<
- typename mpl::deref<BaseUnitDimensions>::type
- > result;
- typedef typename calculate_base_dimension_coefficients_impl<N-1>::template apply<
- typename mpl::next<BaseUnitDimensions>::type,
- Dim,
- typename mpl::push_front<T, typename result::type>::type
- > next_;
- typedef typename next_::type type;
- typedef typename mpl::push_front<typename next_::next, typename result::next>::type next;
- };
-};
-
-template<>
-struct calculate_base_dimension_coefficients_impl<0> {
- template<class Begin, class BaseUnitDimensions, class T>
- struct apply {
- typedef T type;
- typedef mpl::list0<> next;
- };
-};
-
-// solve_for_base_dimension_impl computes the
-// coefficients of each unit for all the base_dimensions.
-// the inner lists are in reverse order.
-
-template<int N>
-struct get_equations_for_base_dimension_impl {
- template<class Begin, class Units>
- struct apply {
- typedef typename calculate_base_dimension_coefficients_impl<mpl::size<Units>::value>::template apply<
- typename mpl::begin<Units>::type,
- typename mpl::deref<Begin>::type,
- mpl::list0<>
- > x;
- typedef typename mpl::push_front<
- typename get_equations_for_base_dimension_impl<N-1>::template apply<
- typename mpl::next<Begin>::type,
- typename x::next
- >::type,
- typename x::type
- >::type type;
- };
-};
-
-template<>
-struct get_equations_for_base_dimension_impl<0> {
- template<class Begin, class Units>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-// get_dimension_iterators_impl takes a list of base_units
-// and returns a list of the begin iterators of their
-// dimensions
-
-template<int N>
-struct get_dimension_iterators_impl {
- template<class Begin>
- struct apply {
- typedef typename mpl::push_front<
- typename get_dimension_iterators_impl<N-1>::template apply<typename mpl::next<Begin>::type>::type,
- typename mpl::begin<typename mpl::deref<Begin>::type::dimension_type>::type
- >::type type;
- };
-};
-
-template<>
-struct get_dimension_iterators_impl<0> {
- template<class Begin>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-// prepare_equations takes the result of
-// solve_for_base_dimension_impl and an index.
-// it sets the equation at the index equal to
-// one and all the others to zero. In the process
-// it reverses the inner lists thus yielding
-// a matrix that can be passed to solve.
-
-template<int N>
-struct prepare_equations_impl {
- template<class Begin, int M>
- struct apply {
- typedef typename mpl::push_front<
- typename prepare_equations_impl<N-1>::template apply<typename mpl::next<Begin>::type, M - 1>::type,
- typename mpl::reverse<typename mpl::push_front<typename mpl::deref<Begin>::type, static_rational<(M == 0 ? 1 : 0)> >::type>::type
- >::type type;
- };
-};
-
-template<>
-struct prepare_equations_impl<0> {
- template<class Begin, int M>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-// add_zeroes pushs N zeroes onto the
-// front of a list.
-//
-// list<rational> add_zeroes(list<rational> l, int N) {
-// if(N == 0) {
-// return(l);
-// } else {
-// return(push_front(add_zeroes(l, N-1), 0));
-// }
-// }
-
-template<int N>
-struct add_zeroes_impl {
- template<class T>
- struct apply {
- typedef typename mpl::push_front<
- typename add_zeroes_impl<N-1>::template apply<T>::type,
- static_rational<0>
- >::type type;
- };
-};
-
-template<>
-struct add_zeroes_impl<0> {
- template<class T>
- struct apply {
- typedef T type;
- };
-};
-
-// add_solutions takes a list of equations
-// for the extra dummy units and a list
-// of the values of all the regular units.
-// It find the coefficients of all the dummy
-// units and pushes them onto the begining
-// of the list in reverse order (since the
-// dummy equations are reversed).
-
-template<int N>
-struct add_solutions_impl {
- template<class Begin, class T, class Solution>
- struct apply {
- typedef typename add_solutions_impl<N-1>::template apply<
- typename mpl::next<Begin>::type,
- typename mpl::push_front<
- T,
- typename substitute_impl<mpl::size<Solution>::value>::template apply<
- typename mpl::begin<typename mpl::deref<Begin>::type>::type,
- typename mpl::begin<Solution>::type
- >::type
- >::type,
- Solution
- >::type type;
- };
-};
-
-template<>
-struct add_solutions_impl<0> {
- template<class Begin, class T, class Solution>
- struct apply {
- typedef T type;
- };
-};
-
-// normalize_units finds the units corresponding
-// to each base dimension. The form of the result is
-// a two dimensional list. list<list<rational> >.
-// each of the inner lists represents a single
-// base dimension. There may be extra units added
-// to the front of the inner list if there are
-// more base dimensions than base units. The
-// number such units is returned as a long called
-// extra. For example list<pound, foot> will yield
-// list<list<0, 0, 1>,list<1, 0, 0>,list<1/2,-1/2,1/2> > meaning
-//
-// length = 0 * mass + 0 * force + 1 * length
-// mass = 1 * mass + 0 * force + 0 * length
-// time = 1/2 * mass - 1/2 * force + 1/2 * length
-//
-// Why is there a dummy mass unit? It isn't
-// possible to represent three base dimensions
-// with only two base units. So we need some
-// kind of dummy. Why mass? Well, a base
-// unit of length doesn't help us since we
-// already have one. Mass is before time
-// so we use mass.
-
-// S is the solution for this particular base dimension.
-// if the base dimension cannot be represented then
-// solve will return inconsistant hence the two specializations.
-
-template<class S>
-struct normalize_units_func {
- template<class ReverseEquations, int M, class DimensionIterator, int N, int Extra, int I,class ExtraEquations>
- struct apply {
- // first add zeroes for all the extra units that
- // are not needed.
- typedef typename add_zeroes_impl<Extra-mpl::size<ExtraEquations>::value>::template apply<S>::type result1;
- // then find the values for the extra units that /are/ needed.
- typedef typename add_solutions_impl<mpl::size<ExtraEquations>::value>::template apply<
- typename mpl::begin<ExtraEquations>::type,
- result1,
- S
- >::type result;
- // recurse back to the primary loop putting
- // push_front outside since we wish to maintain
- // the original ordering of dimensions
- typedef typename mpl::push_front<
- typename normalize_units_impl<N-1>::template apply<
- // The coefficient are still the same
- // and we don't need to remove any equations
- ReverseEquations,
- // increment the number of equations that
- // need to be skipped when we add another
- // dummy unit.
- M+1,
- typename mpl::next<DimensionIterator>::type,
- Extra,
- // increment the number of dimensions we've seen
- I+1,
- // pass the equations for the dummy
- // units on without modification.
- ExtraEquations
- >::type,
- result
- >::type type;
- };
-};
-
-// handles the case when this base dimension
-// cannot be represented with the base units
-// and the dummies allready added.
-template<>
-struct normalize_units_func<inconsistant> {
- template<class ReverseEquations, int M, class DimensionIterator, int N, int Extra, int I, class ExtraEquations>
- struct apply {
- // Find the position that needs to be erased. (Since this
- // 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 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
- typename mpl::erase<
- ReverseEquations,
- pos
- >::type,
- M,
- typename mpl::next<DimensionIterator>::type,
- Extra,
- // Increment the number of dimensions we've seen
- I+1,
- // Add "current_equation == 0" to the list of equations
- // for the dummy units. (For all base dimensions
- // except this the current dimension must sum to
- // zero.)
- typename mpl::push_front<
- ExtraEquations,
- // Remember it's backwards
- typename mpl::reverse<
- typename mpl::push_front<typename mpl::deref<pos>::type, static_rational<0> >::type
- >::type
- >::type
- > next;
- // this dimension is (0, ..., 0, 1, 0, ..., 0)
- typedef typename mpl::push_front<
- typename add_zeroes_impl<N-1>::template apply<mpl::list0<> >::type,
- static_rational<1>
- >::type result1;
- typedef typename add_zeroes_impl<I>::template apply<result1>::type result;
- // Push the result onto the list.
- typedef typename mpl::push_front<typename next::type, result>::type type;
- };
-};
-
-template<int N>
-struct normalize_units_impl {
- template<class ReverseEquations, int M, class DimensionIterator, int Extra, int I, class ExtraEquations>
- struct apply {
- typedef typename solve<
- typename prepare_equations_impl<
- mpl::size<ReverseEquations>::value
- >::template apply<
- typename mpl::begin<ReverseEquations>::type,
- M
- >::type
- >::type solution;
- typedef typename normalize_units_func<solution>::template apply<
- ReverseEquations,
- M,
- DimensionIterator,
- N,
- Extra,
- I,
- ExtraEquations
- >::type type;
- };
-};
-
-template<>
-struct normalize_units_impl<0> {
- template<class ReverseEquations, int M, class DimensionIterator, int Extra, int I, class ExtraEquations>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-template<class T>
-struct normalize_units {
- typedef typename find_base_dimensions<T>::type dimensions;
- typedef typename get_dimension_iterators_impl<mpl::size<T>::value>::template apply<typename mpl::begin<T>::type>::type iterators;
- typedef typename get_equations_for_base_dimension_impl<
- mpl::size<dimensions>::value
- >::template apply<
- typename mpl::begin<dimensions>::type,
- iterators
- >::type reverse_equations;
- static const long extra = mpl::size<reverse_equations>::value - mpl::size<T>::value;
- typedef typename normalize_units_impl<mpl::size<reverse_equations>::value>::template apply<
- reverse_equations,
- 0,
- typename mpl::begin<dimensions>::type,
- extra,
- 0,
- mpl::list0<>
- >::type type;
-};
-
-// expand_dimensions finds the exponents of
-// a set of dimensions in a dimension_list.
-// the second parameter is assumed to be
-// a superset of the base_dimensions of
-// the first parameter.
-//
-// list<rational> expand_dimensions(dimension_list, list<base_dimension>);
-
-template<int N>
-struct expand_dimensions {
- template<class Begin, class DimensionIterator>
- struct apply {
- typedef typename calculate_base_dimension_coefficients_func<
- begins_with_dimension<DimensionIterator>::template apply<typename mpl::deref<Begin>::type>::value
- >::template apply<DimensionIterator> result;
- typedef typename mpl::push_front<
- typename expand_dimensions<N-1>::template apply<typename mpl::next<Begin>::type, typename result::next>::type,
- typename result::type
- >::type type;
- };
-};
-
-template<>
-struct expand_dimensions<0> {
- template<class Begin, class DimensionIterator>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-// multiply_add_units computes M x V
-// where M is a matrix and V is a horizontal
-// vector
-//
-// list<rational> multiply_add_units(list<list<rational> >, list<rational>);
-
-template<int N>
-struct multiply_add_units_impl {
- template<class Begin1, class Begin2 ,class X>
- struct apply {
- typedef typename mpl::push_front<
- typename multiply_add_units_impl<N-1>::template apply<
- typename mpl::next<Begin1>::type,
- typename mpl::next<Begin2>::type,
- X
- >::type,
- typename mpl::plus<
- typename mpl::times<
- typename mpl::deref<Begin2>::type,
- X
- >::type,
- typename mpl::deref<Begin1>::type
- >::type
- >::type type;
- };
-};
-
-template<>
-struct multiply_add_units_impl<0> {
- template<class Begin1, class Begin2 ,class X>
- struct apply {
- typedef mpl::list0<> type;
- };
-};
-
-template<int N>
-struct multiply_add_units {
- template<class Begin1, class Begin2>
- struct apply {
- typedef typename multiply_add_units_impl<
- mpl::size<typename mpl::deref<Begin2>::type>::value
- >::template apply<
- typename mpl::begin<
- typename multiply_add_units<N-1>::template apply<
- typename mpl::next<Begin1>::type,
- typename mpl::next<Begin2>::type
- >::type
- >::type,
- typename mpl::begin<typename mpl::deref<Begin2>::type>::type,
- typename mpl::deref<Begin1>::type
- >::type type;
- };
-};
-
-template<>
-struct multiply_add_units<1> {
- template<class Begin1, class Begin2>
- struct apply {
- typedef typename add_zeroes_impl<
- mpl::size<typename mpl::deref<Begin2>::type>::value
- >::template apply<mpl::list0<> >::type type1;
- typedef typename multiply_add_units_impl<
- mpl::size<typename mpl::deref<Begin2>::type>::value
- >::template apply<
- typename mpl::begin<
- type1
- >::type,
- typename mpl::begin<typename mpl::deref<Begin2>::type>::type,
- typename mpl::deref<Begin1>::type
- >::type type;
- };
-};
-
-// strip_zeroes erases the first N elements of a list if
-// they are all zero, otherwise returns inconsistant
-//
-// list strip_zeroes(list l, int N) {
-// if(N == 0) {
-// return(l);
-// } else if(l.front == 0) {
-// return(strip_zeroes(pop_front(l), N-1));
-// } else {
-// return(inconsistant);
-// }
-// }
-
-template<int N>
-struct strip_zeroes_impl;
-
-template<class T>
-struct strip_zeroes_func {
- template<class L, int N>
- struct apply {
- typedef inconsistant type;
- };
-};
-
-template<>
-struct strip_zeroes_func<static_rational<0> > {
- template<class L, int N>
- struct apply {
- typedef typename strip_zeroes_impl<N-1>::template apply<typename mpl::pop_front<L>::type>::type type;
- };
-};
-
-template<int N>
-struct strip_zeroes_impl {
- template<class T>
- struct apply {
- typedef typename strip_zeroes_func<typename mpl::front<T>::type>::template apply<T, N>::type type;
- };
-};
-
-template<>
-struct strip_zeroes_impl<0> {
- template<class T>
- struct apply {
- typedef T type;
- };
-};
-
-// Given a list of base_units, computes the
-// exponents of each base unit for a given
-// dimension.
-//
-// list<rational> calculate_base_unit_exponents(list<base_unit> units, dimension_list dimensions);
-//
-// What is the purpose of all this magic with
-// base_dimensions? Can't we just solve the
-// equations for the dimension directly? Yes,
-// we can, but remember that solving a
-// system of linear equations is O(N^3).
-// By normalizing the system we incur a
-// high one time cost O(N^4), but for all
-// solutions after the first it is O(N^2)
-// In addition, the constant factor is
-// good because everything is already set up.
-// Since we expect a few systems to be
-// used many times, the cost of creating
-// a system is probably not significant.
-
-template<class T, class Dimensions>
-struct calculate_base_unit_exponents {
- // find the units that correspond to each base dimension
- 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
- // dimension_list<mass,time^-2> then this step will
- // yield list<0,1,-2>
- typedef typename expand_dimensions<mpl::size<typename base_solutions::dimensions>::value>::template apply<
- typename mpl::begin<typename base_solutions::dimensions>::type,
- typename mpl::begin<Dimensions>::type
- >::type dimensions;
- // take the unit corresponding to each base unit
- // multiply each of its exponents by the exponent
- // of the base_dimension in the result and sum.
- typedef typename multiply_add_units<mpl::size<dimensions>::value>::template apply<
- typename mpl::begin<dimensions>::type,
- typename mpl::begin<typename base_solutions::type>::type
- >::type units;
- // Now, verify that the dummy units really
- // cancel out and remove them.
- typedef typename strip_zeroes_impl<base_solutions::extra>::template apply<units>::type type;
-};
-
-} // namespace detail
-
-} // namespace units
-
-} // namespace boost
-
-#endif

Deleted: sandbox/units/boost/units/experimental/make_system.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/make_system.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,159 +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_MAKE_SYSTEM_HPP_INCLUDED
-#define BOOST_UNITS_MAKE_SYSTEM_HPP_INCLUDED
-
-#include <boost/mpl/list/list10.hpp>
-
-#include <boost/units/config.hpp>
-#include <boost/units/experimental/sort.hpp>
-
-#ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
-
-#include <boost/is_same.hpp>
-#include <boost/mpl/not.hpp>
-
-#include <boost/units/experimental/linear_algebra.hpp>
-
-#endif
-
-namespace boost {
-
-namespace units {
-
-template<class L>
-struct homogeneous_system {
- typedef L type;
-};
-
-template<class L, long N, long D>
-struct static_power<homogeneous_system<L>, static_rational<N,D> > {
- typedef homogeneous_system<L> type;
-};
-
-template<class L, long N, long D>
-struct static_root<homogeneous_system<L>, static_rational<N,D> > {
- typedef homogeneous_system<L> type;
-};
-
-namespace detail {
-
-template<class System, class Dimensions>
-struct check_system;
-
-#ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
-
-template<class L, class Dimensions>
-struct check_system<homogeneous_system<L>, Dimensions> :
- boost::mpl::not_<
- boost::is_same<
- typename calculate_base_unit_exponents<
- L,
- Dimensions
- >::type,
- inconsistant
- >
- > {};
-
-#else
-
-template<class L, class Dimensions>
-struct check_system<homogeneous_system<L>, Dimensions> : mpl::true_ {
-};
-
-#endif
-
-}
-
-struct na {};
-
-template<
- class U0 = na,
- class U1 = na,
- class U2 = na,
- class U3 = na,
- class U4 = na,
- class U5 = na,
- class U6 = na,
- class U7 = na,
- class U8 = na,
- class U9 = na
->
-struct make_system;
-
-template<>
-struct make_system<> {
- typedef homogeneous_system<mpl::list0<> > type;
-};
-
-template<class T0>
-struct make_system<T0> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list1<T0> >::type> type;
-};
-
-template<class T0, class T1>
-struct make_system<T0, T1> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list2<T0, T1> >::type> type;
-};
-
-template<class T0, class T1, class T2>
-struct make_system<T0, T1, T2> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list3<T0, T1, T2> >::type> type;
-};
-
-template<class T0, class T1, class T2, class T3>
-struct make_system<T0, T1, T2, T3> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list4<T0, T1, T2, T3> >::type> type;
-};
-
-template<class T0, class T1, class T2, class T3, class T4>
-struct make_system<T0, T1, T2, T3, T4> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list5<T0, T1, T2, T3, T4> >::type> type;
-};
-
-template<class T0, class T1, class T2, class T3, class T4, class T5>
-struct make_system<T0, T1, T2, T3, T4, T5> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list6<T0, T1, T2, T3, T4, T5> >::type> type;
-};
-
-template<class T0, class T1, class T2, class T3, class T4, class T5, class T6>
-struct make_system<T0, T1, T2, T3, T4, T5, T6> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list7<T0, T1, T2, T3, T4, T5, T6> >::type> type;
-};
-
-template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7>
-struct make_system<T0, T1, T2, T3, T4, T5, T6, T7> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list8<T0, T1, T2, T3, T4, T5, T6, T7> >::type> type;
-};
-
-template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
-struct make_system<T0, T1, T2, T3, T4, T5, T6, T7, T8> {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list9<T0, T1, T2, T3, T4, T5, T6, T7, T8> >::type> type;
-};
-
-template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9>
-struct make_system {
- typedef homogeneous_system<typename detail::bubble_sort<mpl::list10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::type> type;
-};
-
-} // namespace units
-
-} // namespace boost
-
-#if BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::homogeneous_system, (class))
-
-#endif
-
-#endif

Deleted: sandbox/units/boost/units/experimental/one.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/one.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,96 +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_ONE_HPP
-#define BOOST_UNITS_ONE_HPP
-
-#include <boost/units/operators.hpp>
-
-namespace boost {
-
-namespace units {
-
-struct one { };
-
-template<class T>
-struct multiply_typeof_helper<one, T>
-{
- typedef T type;
-};
-
-template<class T>
-struct multiply_typeof_helper<T, one>
-{
- typedef T type;
-};
-
-template<>
-struct multiply_typeof_helper<one, one>
-{
- typedef one type;
-};
-
-template<class T>
-inline T operator*(const one&, const T& t)
-{
- return(t);
-}
-
-template<class T>
-inline T operator*(const T& t, const one&)
-{
- return(t);
-}
-
-inline one operator*(const one&, const one&)
-{
- return(one());
-}
-
-template<class T>
-struct divide_typeof_helper<T, one>
-{
- typedef T type;
-};
-
-template<class T>
-struct divide_typeof_helper<one, T>
-{
- typedef T type;
-};
-
-template<>
-struct divide_typeof_helper<one, one>
-{
- typedef one type;
-};
-
-template<class T>
-inline T operator/(const T& t, const one&)
-{
- return(t);
-}
-
-template<class T>
-inline T operator/(const one&, const T& t)
-{
- return(1/t);
-}
-
-inline one operator/(const one&, const one&)
-{
- return(one());
-}
-
-} // namespace units
-
-} // namespace boost
-
-#endif

Deleted: sandbox/units/boost/units/experimental/scaled_base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/scaled_base_unit.hpp 2007-05-28 16:18:50 EDT (Mon, 28 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> > {
- static const long 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_> \
-{ \
- static const long 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,value,name,symbol) \
- BOOST_UNITS_SCALE_SPECIALIZATION(10,static_rational<exponent>,value, name, symbol)
-
-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);
-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_base_unit_tag {};
-
-template<class S, class Scale>
-struct scaled_base_unit
-{
- 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;
- typedef unit<
- dimension_type,
- heterogeneous_system<
- heterogeneous_system_pair<
- dimension_list<
- heterogeneous_system_dim<scaled_base_unit,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_base_unit, (class)(class))
-
-#endif
-
-namespace boost {
-
-namespace units {
-
-template<class T>
-struct unscale {
- typedef T type;
-};
-
-template<class S, class Scale>
-struct unscale<scaled_base_unit<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_base_unit<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_base_unit_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_base_unit_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_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) ||
- ((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

Deleted: sandbox/units/boost/units/experimental/sort.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/sort.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,105 +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_EXPERIMENTAL_SORT_HPP_INCLUDED
-#define BOOST_UNITS_EXPERIMENTAL_SORT_HPP_INCLUDED
-
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/next.hpp>
-#include <boost/mpl/deref.hpp>
-
-#include <boost/units/dimension_list.hpp>
-#include <boost/units/dimensionless_type.hpp>
-
-namespace boost {
-
-namespace units {
-
-namespace detail {
-
-template<bool second_is_less>
-struct bubble_sort_conditional_swap;
-
-template<>
-struct bubble_sort_conditional_swap<true> {
- template<class T0, class T1>
- struct apply {
- typedef T1 first;
- typedef T0 second;
- };
-};
-
-template<>
-struct bubble_sort_conditional_swap<false> {
- template<class T0, class T1>
- struct apply {
- typedef T0 first;
- typedef T1 second;
- };
-};
-
-template<int N>
-struct bubble_sort_pass_impl {
- template<class Begin, class Current>
- struct apply {
- typedef typename mpl::deref<Begin>::type val;
- typedef typename bubble_sort_conditional_swap<mpl::less<val, Current>::value>::template apply<Current, val> pair;
- typedef typename bubble_sort_pass_impl<N-1>::template apply<typename mpl::next<Begin>::type, typename pair::second> next;
- typedef typename mpl::push_front<typename next::type, typename pair::first>::type type;
- enum { value = next::value || mpl::less<val, Current>::value };
- };
-};
-
-template<>
-struct bubble_sort_pass_impl<0> {
- template<class Begin, class Current>
- struct apply {
- typedef typename mpl::push_front<dimensionless_type, Current>::type type;
- enum { value = false };
- };
-};
-
-template<bool>
-struct bubble_sort_impl;
-
-template<>
-struct bubble_sort_impl<true> {
- template<class T>
- struct apply {
- typedef typename mpl::begin<T>::type begin;
- typedef typename bubble_sort_pass_impl<mpl::size<T>::value - 1>::template apply<
- typename mpl::next<begin>::type,
- typename mpl::deref<begin>::type
- > single_pass;
- typedef typename bubble_sort_impl<(single_pass::value)>::template apply<typename single_pass::type>::type type;
- };
-};
-
-template<>
-struct bubble_sort_impl<false> {
- template<class T>
- struct apply {
- typedef T type;
- };
-};
-
-template<class T>
-struct bubble_sort {
- typedef typename bubble_sort_impl<((mpl::size<T>::value) > 1)>::template apply<T>::type type;
-};
-
-} // namespace detail
-
-} // namespace units
-
-} // namespace boost
-
-#endif

Deleted: sandbox/units/boost/units/experimental/static_rational_power.hpp
==============================================================================
--- sandbox/units/boost/units/experimental/static_rational_power.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,140 +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_STATIC_RATIONAL_POWER_HPP
-#define BOOST_UNITS_STATIC_RATIONAL_POWER_HPP
-
-#include <cmath>
-
-#include <boost/units/static_rational.hpp>
-#include <boost/units/experimental/one.hpp>
-
-namespace boost {
-
-namespace units {
-
-namespace detail {
-
-template<class R, class Y>
-struct static_rational_power_impl
-{
- static Y apply(const Y& y)
- {
- return(std::pow(y, value<Y>(R())));
- }
-};
-
-template<class R>
-struct static_rational_power_impl<R, one>
-{
- static one apply(const one&)
- {
- return(one());
- }
-};
-
-template<long N>
-struct static_rational_power_impl<static_rational<N>, one>
-{
- static one apply(const one&)
- {
- return(one());
- }
-};
-
-template<integer_type N, bool = (N % 2 == 0)>
-struct static_int_power_impl;
-
-template<integer_type N>
-struct static_int_power_impl<N, true>
-{
- template<class Y, class R>
- static Y apply(const Y& y, const R& r) {
- const Y square = y * y;
- return(static_int_power_impl<(N >> 1)>::apply(square, r));
- }
-};
-
-template<integer_type N>
-struct static_int_power_impl<N, false>
-{
- template<class Y, class R>
- static Y apply(const Y& y, const R& r)
- {
- const Y square = y * y;
- return(static_int_power_impl<(N >> 1)>::apply(square, y * r));
- }
-};
-
-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>
- static Y apply(const Y&, const R& r)
- {
- return(r);
- }
-};
-
-template<int N, bool = (N < 0)>
-struct static_int_power_sign_impl;
-
-template<int N>
-struct static_int_power_sign_impl<N, false>
-{
- template<class Y>
- static Y apply(const Y& y)
- {
- return(static_int_power_impl<N>::apply(y, one()));
- }
-};
-
-template<int N>
-struct static_int_power_sign_impl<N, true>
-{
- template<class Y>
- static Y apply(const Y& y)
- {
- return(one()/static_int_power_impl<-N>::apply(y, one()));
- }
-};
-
-template<integer_type N, class Y>
-struct static_rational_power_impl<static_rational<N>, Y>
-{
- static Y apply(const Y& y)
- {
- return(static_int_power_sign_impl<N>::apply(y));
- }
-};
-
-template<class R, class Y>
-Y static_rational_power(const Y& y)
-{
- return(detail::static_rational_power_impl<R, Y>::apply(y));
-}
-
-} // namespace detail
-
-} // namespace units
-
-} // namespace boost
-
-#endif

Copied: sandbox/units/boost/units/heterogeneous_system.hpp (from r4254, /sandbox/units/boost/units/experimental/heterogeneous_system.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/heterogeneous_system.hpp (original)
+++ sandbox/units/boost/units/heterogeneous_system.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_EXPERIMENTAL_HETEROGENEOUS_SYSTEM_HPP
-#define BOOST_UNITS_EXPERIMENTAL_HETEROGENEOUS_SYSTEM_HPP
+#ifndef BOOST_UNITS_HETEROGENEOUS_SYSTEM_HPP
+#define BOOST_UNITS_HETEROGENEOUS_SYSTEM_HPP
 
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/plus.hpp>
@@ -22,9 +22,9 @@
 
 #include <boost/units/static_rational.hpp>
 #include <boost/units/dimension.hpp>
+#include <boost/units/scaled_base_unit.hpp>
 #include <boost/units/detail/push_front_if.hpp>
-#include <boost/units/experimental/scaled_base_unit.hpp>
-#include <boost/units/experimental/linear_algebra.hpp>
+#include <boost/units/detail/linear_algebra.hpp>
 
 namespace boost {
 

Copied: sandbox/units/boost/units/io.hpp (from r4335, /sandbox/units/boost/units/experimental/io.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/io.hpp (original)
+++ sandbox/units/boost/units/io.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -8,8 +8,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_UNITS_EXPERIMENTAL_IO_HPP
-#define BOOST_UNITS_EXPERIMENTAL_IO_HPP
+#ifndef BOOST_UNITS_IO_HPP
+#define BOOST_UNITS_IO_HPP
 
 #include <string>
 #include <iosfwd>
@@ -18,13 +18,30 @@
 #include <boost/mpl/begin.hpp>
 #include <boost/mpl/next.hpp>
 #include <boost/mpl/deref.hpp>
+#include <boost/serialization/nvp.hpp>
 
 #include <boost/units/unit.hpp>
 #include <boost/units/quantity.hpp>
-#include <boost/units/experimental/heterogeneous_system.hpp>
+#include <boost/units/heterogeneous_system.hpp>
 
 namespace boost {
 
+namespace serialization {
+
+/// Boost Serialization library support for units.
+template<class Archive,class System,class Dim>
+inline void serialize(Archive& ar,boost::units::unit<Dim,System>&,const unsigned int /*version*/)
+{ }
+
+/// Boost Serialization library support for quantities.
+template<class Archive,class Unit,class Y>
+inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsigned int /*version*/)
+{
+ ar & boost::serialization::make_nvp("value", units::quantity_cast<Y&>(q));
+}
+
+} // namespace serialization
+
 namespace units {
 
 /// Write integral-valued @c static_rational to @c std::basic_ostream.

Copied: sandbox/units/boost/units/make_system.hpp (from r4254, /sandbox/units/boost/units/experimental/make_system.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/make_system.hpp (original)
+++ sandbox/units/boost/units/make_system.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -14,14 +14,14 @@
 #include <boost/mpl/list/list10.hpp>
 
 #include <boost/units/config.hpp>
-#include <boost/units/experimental/sort.hpp>
+#include <boost/units/detail/sort.hpp>
 
 #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
 
 #include <boost/is_same.hpp>
 #include <boost/mpl/not.hpp>
 
-#include <boost/units/experimental/linear_algebra.hpp>
+#include <boost/units/detail/linear_algebra.hpp>
 
 #endif
 

Copied: sandbox/units/boost/units/scaled_base_unit.hpp (from r4254, /sandbox/units/boost/units/experimental/scaled_base_unit.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/scaled_base_unit.hpp (original)
+++ sandbox/units/boost/units/scaled_base_unit.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -13,13 +13,11 @@
 
 #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>
+#include <boost/units/detail/one.hpp>
+#include <boost/units/detail/static_rational_power.hpp>
 
 namespace boost {
 

Deleted: sandbox/units/boost/units/system.hpp
==============================================================================
--- sandbox/units/boost/units/system.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
+++ (empty file)
@@ -1,128 +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_SYSTEM_HPP
-#define BOOST_UNITS_SYSTEM_HPP
-
-#if 0
-
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/bool_fwd.hpp>
-#include <boost/mpl/push_front.hpp>
-#include <boost/mpl/size.hpp>
-
-#include <boost/units/operators.hpp>
-#include <boost/units/detail/system_impl.hpp>
-
-namespace boost {
-
-namespace units {
-
-/// check if a class is a valid unit system
-template<class S> struct is_system;
-
-template<class S>
-struct is_system< homogeneous_system<S> >
-{
- typedef boost::mpl::true_ type;
-
- static const bool value = true;
-};
-
-template<class S>
-struct is_system< heterogeneous_system<S> >
-{
- typedef boost::mpl::true_ type;
-
- static const bool value = true;
-};
-
-/// check if a class is a homogeneous unit system
-template<class S> struct is_homogeneous_system;
-
-template<class S>
-struct is_homogeneous_system< homogeneous_system<S> >
-{
- typedef boost::mpl::true_ type;
-
- static const bool value = true;
-};
-
-template<class S>
-struct is_homogeneous_system< heterogeneous_system<S> >
-{
- typedef boost::mpl::false_ type;
-
- static const bool value = false;
-};
-
-/// check if a class is a heterogeneous unit system
-template<class S> struct is_heterogeneous_system;
-
-template<class S>
-struct is_heterogeneous_system< homogeneous_system<S> >
-{
- typedef boost::mpl::false_ type;
-
- static const bool value = false;
-};
-
-template<class S>
-struct is_heterogeneous_system< heterogeneous_system<S> >
-{
- typedef boost::mpl::true_ type;
-
- static const bool value = true;
-};
-
-} // namespace units
-
-namespace mpl {
-
-template<>
-struct plus_impl<boost::units::detail::heterogeneous_system_element_tag, boost::units::detail::heterogeneous_system_element_tag>
-{
- template<class T0, class T1>
- struct apply {
- BOOST_STATIC_ASSERT((boost::is_same<typename T0::tag_type, typename T1::tag_type>::value == true));
- typedef boost::units::heterogeneous_system_element<typename T0::tag_type, typename times<typename T0::value_type, typename T1::value_type>::type> type;
- };
-};
-
-template<>
-struct negate_impl<boost::units::detail::heterogeneous_system_element_tag>
-{
- template<class T0>
- struct apply {
- typedef typename boost::units::detail::static_inverse_impl<
- mpl::size<typename T0::value_type>::value
- >::template apply<typename mpl::begin<typename T0::value_type>::type>::type inverse;
- typedef boost::units::heterogeneous_system_element<typename T0::tag_type, inverse> type;
- };
-};
-
-} // namespace mpl
-
-namespace units {
-
-template<class System, class Dimensions>
-struct heterogeneous_system_view
-{
- typedef typename mpl::push_front<dimensionless_type, heterogeneous_system_element<System, Dimensions> >::type type;
- typedef Dimensions dimension;
-};
-
-} // namespace units
-
-} // namespace boost
-
-#endif
-
-#endif // BOOST_UNITS_SYSTEM_HPP

Modified: sandbox/units/boost/units/systems/abstract.hpp
==============================================================================
--- sandbox/units/boost/units/systems/abstract.hpp (original)
+++ sandbox/units/boost/units/systems/abstract.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -14,36 +14,11 @@
 #include <string>
 
 #include <boost/units/conversion.hpp>
-#include <boost/units/ordinal.hpp>
-#include <boost/units/system.hpp>
 #include <boost/units/systems/physical_units.hpp>
 #include <boost/units/quantity.hpp>
 
-#include <boost/units/experimental/make_system.hpp>
-#include <boost/units/experimental/base_unit.hpp>
-
-//namespace boost {
-//
-//namespace units {
-//
-//namespace abstract {
-//
-///// abstract unit system for pure dimensional analysis
-//struct system_tag : public ordinal<-6> { };
-//
-//}
-//
-//}
-//
-//}
-//
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TYPE(boost::units::abstract::system_tag)
-//
-//#endif
+#include <boost/units/make_system.hpp>
+#include <boost/units/base_unit.hpp>
 
 namespace boost {
 
@@ -148,14 +123,6 @@
     static std::string symbol() { return "[QS]"; }
 };
 
-///// prevent conversions from abstract quantities to any other system
-//template<typename DimTag,typename SysTag>
-//struct base_unit_converter<DimTag,abstract::system_tag,SysTag> { };
-//
-///// prevent conversions from any other system to abstract quantities
-//template<typename DimTag,typename SysTag>
-//struct base_unit_converter<DimTag,SysTag,abstract::system_tag> { };
-
 } // namespace units
 
 } // namespace boost

Modified: sandbox/units/boost/units/systems/angle/degrees.hpp
==============================================================================
--- sandbox/units/boost/units/systems/angle/degrees.hpp (original)
+++ sandbox/units/boost/units/systems/angle/degrees.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -17,32 +17,9 @@
 #include <boost/units/io.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/static_constant.hpp>
-#include <boost/units/system.hpp>
+#include <boost/units/make_system.hpp>
 #include <boost/units/systems/physical_units.hpp>
-#include <boost/units/experimental/fundamental_units.hpp>
-#include <boost/units/experimental/make_system.hpp>
-
-//namespace boost {
-//
-//namespace units {
-//
-//namespace degree {
-//
-//struct system_tag : public ordinal<-3> { }; ///< unit system tag for angles in degrees
-//
-//} // namespace degree
-//
-//} // namespace units
-//
-//} // namespace boost
-//
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TYPE(boost::units::degree::system_tag)
-//
-//#endif
+#include <boost/units/systems/base_units.hpp>
 
 namespace boost {
 
@@ -50,7 +27,6 @@
 
 namespace degree {
 
-//typedef homogeneous_system<system_tag> system; ///< degree unit system
 typedef make_system<degree_tag>::type system;
 
 typedef unit<dimensionless_type,system> dimensionless;
@@ -65,6 +41,4 @@
 
 } // namespace boost
 
-//#include <boost/units/systems/conversions/conversion_headers.hpp>
-
 #endif // BOOST_UNITS_DEGREE_HPP

Modified: sandbox/units/boost/units/systems/angle/gradians.hpp
==============================================================================
--- sandbox/units/boost/units/systems/angle/gradians.hpp (original)
+++ sandbox/units/boost/units/systems/angle/gradians.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -17,32 +17,9 @@
 #include <boost/units/io.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/static_constant.hpp>
-#include <boost/units/system.hpp>
+#include <boost/units/make_system.hpp>
 #include <boost/units/systems/physical_units.hpp>
-#include <boost/units/experimental/fundamental_units.hpp>
-#include <boost/units/experimental/make_system.hpp>
-
-//namespace boost {
-//
-//namespace units {
-//
-//namespace gradian {
-//
-//struct system_tag : public ordinal<-2> { }; ///< unit system tag for angles in gradians
-//
-//} // namespace gradian
-//
-//} // namespace units
-//
-//} // namespace boost
-//
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TYPE(boost::units::gradian::system_tag)
-//
-//#endif
+#include <boost/units/systems/base_units.hpp>
 
 namespace boost {
 
@@ -50,7 +27,6 @@
 
 namespace gradian {
 
-//typedef homogeneous_system<system_tag> system; ///< gradian unit system
 typedef make_system<gradian_tag>::type system;
 
 typedef unit<dimensionless_type,system> dimensionless;
@@ -61,17 +37,8 @@
 
 } // namespace gradian
 
-//template<>
-//struct base_unit_info<plane_angle_dim,gradian::system_tag>
-//{
-// static std::string name() { return "gradian"; }
-// static std::string symbol() { return "grad"; }
-//};
-
 } // namespace units
 
 } // namespace boost
 
-//#include <boost/units/systems/conversions/conversion_headers.hpp>
-
 #endif // BOOST_UNITS_GRADIANS_HPP

Copied: sandbox/units/boost/units/systems/base_units.hpp (from r4254, /sandbox/units/boost/units/experimental/fundamental_units.hpp)
==============================================================================
--- /sandbox/units/boost/units/experimental/fundamental_units.hpp (original)
+++ sandbox/units/boost/units/systems/base_units.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -13,9 +13,10 @@
 
 #include <string>
 
+#include <boost/units/config.hpp>
+#include <boost/units/base_unit.hpp>
+#include <boost/units/scaled_base_unit.hpp>
 #include <boost/units/systems/physical_units.hpp>
-#include <boost/units/experimental/base_unit.hpp>
-#include <boost/units/experimental/scaled_base_unit.hpp>
 
 namespace boost {
 
@@ -116,7 +117,7 @@
 BOOST_UNITS_DEFINE_CONVERSION(boost::units::radian_tag, boost::units::gradian_tag::unit_type, double, 200/3.14159265358979323846);
 BOOST_UNITS_DEFINE_CONVERSION(boost::units::degree_tag, boost::units::gradian_tag::unit_type, double, 10/9.);
 
-#ifdef BOOST_UNITS_HAS_BOOST_TYPEOF
+#if BOOST_UNITS_HAS_BOOST_TYPEOF
 
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
 

Modified: sandbox/units/boost/units/systems/cgs/base.hpp
==============================================================================
--- sandbox/units/boost/units/systems/cgs/base.hpp (original)
+++ sandbox/units/boost/units/systems/cgs/base.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -17,11 +17,9 @@
 #include <boost/units/ordinal.hpp>
 #include <boost/units/static_constant.hpp>
 #include <boost/units/unit.hpp>
-#include <boost/units/system.hpp>
+#include <boost/units/make_system.hpp>
 #include <boost/units/systems/physical_units.hpp>
-
-#include <boost/units/experimental/make_system.hpp>
-#include <boost/units/experimental/fundamental_units.hpp>
+#include <boost/units/systems/base_units.hpp>
 
 namespace boost {
 
@@ -30,61 +28,15 @@
 namespace CGS {
 
 /// placeholder class defining CGS unit system
-//struct system_tag : public ordinal<-4> { };
 typedef make_system<centimeter_tag, gram_tag, second_tag>::type system;
 
-}
-
-}
-
-}
-
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TYPE(boost::units::CGS::system_tag)
-//
-//#endif
-
-namespace boost {
-
-namespace units {
-
-namespace CGS {
-
-//typedef homogeneous_system<system_tag> system;
-
 /// various unit typedefs for convenience
 typedef unit<dimensionless_type,system> dimensionless;
 
 } // namespace CGS
                                                     
-//template<>
-//struct base_unit_info<length_dim,CGS::system_tag>
-//{
-// static std::string name() { return "centimeter"; }
-// static std::string symbol() { return "cm"; }
-//};
-//
-//template<>
-//struct base_unit_info<mass_dim,CGS::system_tag>
-//{
-// static std::string name() { return "gram"; }
-// static std::string symbol() { return "g"; }
-//};
-//
-//template<>
-//struct base_unit_info<time_dim,CGS::system_tag>
-//{
-// static std::string name() { return "second"; }
-// static std::string symbol() { return "s"; }
-//};
-
 } // namespace units
 
 } // namespace boost
 
-//#include <boost/units/systems/conversions/conversion_headers.hpp>
-
 #endif // BOOST_UNITS_CGS_BASE_HPP

Modified: sandbox/units/boost/units/systems/physical_units.hpp
==============================================================================
--- sandbox/units/boost/units/systems/physical_units.hpp (original)
+++ sandbox/units/boost/units/systems/physical_units.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -11,11 +11,9 @@
 #ifndef BOOST_UNITS_PHYSICAL_UNITS_HPP
 #define BOOST_UNITS_PHYSICAL_UNITS_HPP
 
+#include <boost/units/config.hpp>
 #include <boost/units/base_dimension.hpp>
 #include <boost/units/derived_dimension.hpp>
-#include <boost/units/static_constant.hpp>
-#include <boost/units/system.hpp>
-#include <boost/units/unit.hpp>
 
 /// \file
 /// \brief Various definitions to simplify systems of physical units.

Modified: sandbox/units/boost/units/systems/si/base.hpp
==============================================================================
--- sandbox/units/boost/units/systems/si/base.hpp (original)
+++ sandbox/units/boost/units/systems/si/base.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -17,11 +17,9 @@
 #include <boost/units/ordinal.hpp>
 #include <boost/units/static_constant.hpp>
 #include <boost/units/unit.hpp>
-#include <boost/units/system.hpp>
+#include <boost/units/make_system.hpp>
 #include <boost/units/systems/physical_units.hpp>
-
-#include <boost/units/experimental/fundamental_units.hpp>
-#include <boost/units/experimental/make_system.hpp>
+#include <boost/units/systems/base_units.hpp>
 
 namespace boost {
 
@@ -30,103 +28,15 @@
 namespace SI {
 
 /// placeholder class defining SI unit system
-//struct system_tag : public ordinal<-5> { };
 typedef make_system<meter_tag, kilogram_tag, second_tag, ampere_tag, kelvin_tag, mole_tag, candela_tag, radian_tag, steradian_tag>::type system;
 
-}
-
-}
-
-}
-
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TYPE(boost::units::SI::system_tag)
-//
-//#endif
-
-namespace boost {
-
-namespace units {
-
-namespace SI {
-
-//typedef homogeneous_system<system_tag> system;
-
 /// dimensionless SI unit
 typedef unit<dimensionless_type,system> dimensionless;
 
 } // namespace SI
 
-//template<>
-//struct base_unit_info<length_dim,SI::system_tag>
-//{
-// static std::string name() { return "meter"; }
-// static std::string symbol() { return "m"; }
-//};
-//
-//template<>
-//struct base_unit_info<mass_dim,SI::system_tag>
-//{
-// static std::string name() { return "kilogram"; }
-// static std::string symbol() { return "kg"; }
-//};
-//
-//template<>
-//struct base_unit_info<time_dim,SI::system_tag>
-//{
-// static std::string name() { return "second"; }
-// static std::string symbol() { return "s"; }
-//};
-//
-//template<>
-//struct base_unit_info<current_dim,SI::system_tag>
-//{
-// static std::string name() { return "ampere"; }
-// static std::string symbol() { return "A"; }
-//};
-//
-//template<>
-//struct base_unit_info<temperature_dim,SI::system_tag>
-//{
-// static std::string name() { return "kelvin"; }
-// static std::string symbol() { return "K"; }
-//};
-//
-//template<>
-//struct base_unit_info<amount_dim,SI::system_tag>
-//{
-// static std::string name() { return "mole"; }
-// static std::string symbol() { return "mol"; }
-//};
-//
-//template<>
-//struct base_unit_info<luminous_intensity_dim,SI::system_tag>
-//{
-// static std::string name() { return "candela"; }
-// static std::string symbol() { return "cd"; }
-//};
-//
-//template<>
-//struct base_unit_info<plane_angle_dim,SI::system_tag>
-//{
-// static std::string name() { return "radian"; }
-// static std::string symbol() { return "rad"; }
-//};
-//
-//template<>
-//struct base_unit_info<solid_angle_dim,SI::system_tag>
-//{
-// static std::string name() { return "steradian"; }
-// static std::string symbol() { return "sr"; }
-//};
-
 } // namespace units
 
 } // namespace boost
 
-//#include <boost/units/systems/conversions/conversion_headers.hpp>
-
 #endif // BOOST_UNITS_SI_BASE_HPP

Modified: sandbox/units/boost/units/unit.hpp
==============================================================================
--- sandbox/units/boost/units/unit.hpp (original)
+++ sandbox/units/boost/units/unit.hpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -14,11 +14,10 @@
 #include <boost/mpl/bool_fwd.hpp>
 
 #include <boost/units/dimension.hpp>
-//#include <boost/units/system.hpp>
 #include <boost/units/units_fwd.hpp>
+#include <boost/units/heterogeneous_system.hpp>
 #include <boost/units/detail/unit_impl.hpp>
-#include <boost/units/experimental/heterogeneous_system.hpp>
-#include <boost/units/experimental/make_system.hpp>
+#include <boost/units/make_system.hpp>
 
 namespace boost {
 

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 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -20,8 +20,8 @@
 #include <boost/units/quantity.hpp>
 #include <boost/units/static_constant.hpp>
 #include <boost/units/unit.hpp>
-#include <boost/units/experimental/base_unit.hpp>
-#include <boost/units/experimental/make_system.hpp>
+#include <boost/units/base_unit.hpp>
+#include <boost/units/make_system.hpp>
 
 namespace boost {
 
@@ -31,9 +31,6 @@
 struct length_dim : boost::units::base_dimension<length_dim, 1> {}; ///> base dimension of length
 struct mass_dim : boost::units::base_dimension<mass_dim,2> {}; ///> base dimension of mass
 struct time_dim : boost::units::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

Modified: sandbox/units/libs/units/example/unit_example_16.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_16.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_16.cpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -39,7 +39,6 @@
 
 #include <boost/units/conversion.hpp>
 #include <boost/units/io.hpp>
-#include <boost/units/system.hpp>
 #include <boost/units/systems/si.hpp>
 #include <boost/units/systems/si/prefixes.hpp>
 

Modified: sandbox/units/libs/units/example/unit_example_21.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_21.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_21.cpp 2007-05-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -33,8 +33,8 @@
 #include <boost/units/unit.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/systems/physical_units.hpp>
-#include <boost/units/experimental/base_unit.hpp>
-#include <boost/units/experimental/make_system.hpp>
+#include <boost/units/base_unit.hpp>
+#include <boost/units/make_system.hpp>
 
 namespace boost {
 

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-28 16:18:50 EDT (Mon, 28 May 2007)
@@ -32,8 +32,8 @@
 #include <boost/units/static_constant.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/io.hpp>
-#include <boost/units/experimental/base_unit.hpp>
-#include <boost/units/experimental/make_system.hpp>
+#include <boost/units/base_unit.hpp>
+#include <boost/units/make_system.hpp>
 
 #define BOOST_UNITS_CHECK_CLOSE(a, b) (BOOST_CHECK((std::abs((a) - (b)) < .0000001)))
 


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