Boost logo

Boost-Commit :

From: steven_watanabe_at_[hidden]
Date: 2007-06-04 14:15:01


Author: steven_watanabe
Date: 2007-06-04 14:15:00 EDT (Mon, 04 Jun 2007)
New Revision: 4435
URL: http://svn.boost.org/trac/boost/changeset/4435

Log:
Split make_system into make_system and homogeneous_system

Added:
   sandbox/units/boost/units/homogeneous_system.hpp
      - copied, changed from r4434, /sandbox/units/boost/units/make_system.hpp
Text files modified:
   sandbox/units/boost/units/conversion.hpp | 136 ++++++++++++++++++++++++------------
   sandbox/units/boost/units/homogeneous_system.hpp | 80 --------------------
   sandbox/units/boost/units/make_system.hpp | 109 +++++++++++-----------------
   sandbox/units/boost/units/quantity.hpp | 1
   sandbox/units/boost/units/unit.hpp | 149 +--------------------------------------
   5 files changed, 144 insertions(+), 331 deletions(-)

Modified: sandbox/units/boost/units/conversion.hpp
==============================================================================
--- sandbox/units/boost/units/conversion.hpp (original)
+++ sandbox/units/boost/units/conversion.hpp 2007-06-04 14:15:00 EDT (Mon, 04 Jun 2007)
@@ -19,7 +19,7 @@
 #include <boost/mpl/divides.hpp>
 
 #include <boost/units/scaled_base_unit.hpp>
-#include <boost/units/make_system.hpp>
+#include <boost/units/homogeneous_system.hpp>
 #include <boost/units/heterogeneous_system.hpp>
 #include <boost/units/detail/one.hpp>
 #include <boost/units/detail/static_rational_power.hpp>
@@ -60,7 +60,8 @@
 /// }
 /// @endcode
 template<class From, class To>
-struct conversion_helper {
+struct conversion_helper
+{
     static To convert(const From&);
 };
 
@@ -68,14 +69,16 @@
 
 /// INTERNAL ONLY
 template<class Source, class Destination>
-struct select_base_unit_converter {
+struct select_base_unit_converter
+{
     typedef Source source_type;
     typedef Destination destination_type;
 };
 
 /// INTERNAL ONLY
 template<class Source, class Destination>
-struct base_unit_converter {
+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;
@@ -85,7 +88,8 @@
     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() {
+ static type value()
+ {
         return(converter::value() * eval_factor::value());
     }
 };
@@ -96,9 +100,11 @@
 struct inverse_base_unit_converter_impl;
 
 template<>
-struct inverse_base_unit_converter_impl<false, false> {
+struct inverse_base_unit_converter_impl<false, false>
+{
     template<class Source, class Destination>
- struct apply {
+ 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;
@@ -108,35 +114,42 @@
         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() {
+ static type value()
+ {
             return(converter::value() * eval_factor::value());
         }
     };
 };
 
 template<>
-struct inverse_base_unit_converter_impl<true, false> {
+struct inverse_base_unit_converter_impl<true, false>
+{
     template<class Source, class Destination>
- struct apply {
+ struct apply
+ {
         typedef base_unit_converter<Destination, typename Source::unit_type> inverse;
         typedef typename inverse::type type;
- static type value() {
+ static type value()
+ {
             return(one()/inverse::value());
         }
     };
 };
 
 template<bool dummy>
-struct inverse_base_unit_converter_impl<dummy, true> {
+struct inverse_base_unit_converter_impl<dummy, true>
+{
     template<class Source, class Destination>
- struct apply {
+ struct apply
+ {
         typedef one type;
         static type value() { return(type()); }
     };
 };
 
 template<class Source, class Dest>
-struct use_inverse_conversion {
+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) };
@@ -157,37 +170,47 @@
>
>
>
-> : detail::inverse_base_unit_converter_impl<detail::use_inverse_conversion<Source, Dest>::value, boost::is_same<Source, Dest>::value>::template apply<Source, Dest> {
-};
+> : detail::inverse_base_unit_converter_impl<
+ detail::use_inverse_conversion<Source, Dest>::value,
+ boost::is_same<Source, Dest>::value
+ >::template apply<Source, Dest>
+{};
 
 /// Defines the conversion factor from a base unit to any unit
 /// with the correct dimensions. Must appear at global scope.
 /// If the destination unit is a unit that contains only one
 /// base unit which is raised to the first power (e.g. feet->meters)
 /// the reverse need not be defined.
-#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_); }\
-};\
-}\
-}\
+#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 {
+struct conversion_impl
+{
     template<class Begin, class DestinationSystem>
- struct apply {
+ struct apply
+ {
         typedef typename conversion_impl<N-1>::template apply<
             typename mpl::next<Begin>::type,
             DestinationSystem
@@ -203,9 +226,11 @@
 };
 
 template<>
-struct conversion_impl<0> {
+struct conversion_impl<0>
+{
     template<class Begin, class DestinationSystem>
- struct apply {
+ struct apply
+ {
         typedef one type;
         static type value() { return(one()); }
     };
@@ -215,14 +240,16 @@
 
 /// conversions between homogeneous systems are defined
 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> > {
+struct conversion_helper<quantity<unit<D, homogeneous_system<L1> >, T1>, quantity<unit<D, homogeneous_system<L2> >, T2> >
+{
     /// INTERNAL ONLY
     typedef quantity<unit<D, homogeneous_system<L2> >, T2> destination_type;
     /// INTERNAL ONLY
     typedef typename reduce_unit<unit<D, homogeneous_system<L1> > >::type source_unit;
     /// INTERNAL ONLY
     typedef typename source_unit::system_type::type unit_list;
- static destination_type convert(const quantity<unit<D, homogeneous_system<L1> >, T1>& source) {
+ 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,
@@ -234,10 +261,12 @@
 
 /// conversions between heterogeneous systems and homogeneous systems are defined
 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> > {
+struct conversion_helper<quantity<unit<D, heterogeneous_system<L1> >, T1>, quantity<unit<D, homogeneous_system<L2> >, T2> >
+{
     /// INTERNAL ONLY
     typedef quantity<unit<D, homogeneous_system<L2> >, T2> destination_type;
- static destination_type convert(const quantity<unit<D, heterogeneous_system<L1> >, T1>& source) {
+ 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,
@@ -252,10 +281,12 @@
 // heterogeneous->homogeneous case
 /// conversions between heterogeneous systems and homogeneous systems are defined
 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> > {
+struct conversion_helper<quantity<unit<D, homogeneous_system<L1> >, T1>, quantity<unit<D, heterogeneous_system<L2> >, T2> >
+{
     /// INTERNAL ONLY
     typedef quantity<unit<D, heterogeneous_system<L2> >, T2> destination_type;
- static destination_type convert(const quantity<unit<D, homogeneous_system<L1> >, T1>& source) {
+ 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,
@@ -265,14 +296,29 @@
     }
 };
 
+/// Requires that all possible conversions
+/// between base units are defined.
 template<class D, class S1, class T1, class S2, class T2>
-struct conversion_helper<quantity<unit<D, heterogeneous_system<S1> >, T1>, quantity<unit<D, heterogeneous_system<S2> >, T2> > {
+struct conversion_helper<quantity<unit<D, heterogeneous_system<S1> >, T1>, quantity<unit<D, heterogeneous_system<S2> >, T2> >
+{
+ /// INTERNAL ONLY
     typedef quantity<unit<D, heterogeneous_system<S1> >, T1> source_type;
+ /// INTERNAL ONLY
     typedef quantity<unit<D, heterogeneous_system<S2> >, T2> destination_type;
- typedef typename detail::extract_base_units<mpl::size<typename S1::type>::value>::template apply<typename mpl::begin<typename S1::type>::type, mpl::list0<> >::type from_base_units;
- typedef typename detail::extract_base_units<mpl::size<typename S2::type>::value>::template apply<typename mpl::begin<typename S2::type>::type, from_base_units>::type all_base_units;
+ /// INTERNAL ONLY
+ typedef typename detail::extract_base_units<mpl::size<typename S1::type>::value>::template apply<
+ typename mpl::begin<typename S1::type>::type,
+ mpl::list0<>
+ >::type from_base_units;
+ /// INTERNAL ONLY
+ typedef typename detail::extract_base_units<mpl::size<typename S2::type>::value>::template apply<
+ typename mpl::begin<typename S2::type>::type,
+ from_base_units
+ >::type all_base_units;
+ /// INTERNAL ONLY
     typedef typename detail::make_homogeneous_system<all_base_units>::type system;
- static destination_type convert(const source_type& source) {
+ static destination_type convert(const source_type& source)
+ {
         return(destination_type::from_value(source.value() *
             (detail::conversion_impl<mpl::size<typename S1::type>::value>::template apply<
                 typename mpl::begin<typename S1::type>::type,

Copied: sandbox/units/boost/units/homogeneous_system.hpp (from r4434, /sandbox/units/boost/units/make_system.hpp)
==============================================================================
--- /sandbox/units/boost/units/make_system.hpp (original)
+++ sandbox/units/boost/units/homogeneous_system.hpp 2007-06-04 14:15:00 EDT (Mon, 04 Jun 2007)
@@ -8,14 +8,11 @@
 // 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>
+#ifndef BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
+#define BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
 
 #include <boost/units/config.hpp>
 #include <boost/units/static_rational.hpp>
-#include <boost/units/detail/sort.hpp>
 
 #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
 
@@ -72,78 +69,7 @@
 
 #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<dimensionless_type> type;
-};
-
-template<class T0>
-struct make_system<T0, na, na, na, na, na, na, na, na, na> {
- typedef homogeneous_system<dimension_list<T0, dimensionless_type> > type;
-};
-
-template<class T0, class T1>
-struct make_system<T0, T1, na, na, na, na, na, na, na, na> {
- 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, na, na, na, na, na, na, na> {
- 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, na, na, na, na, na, na> {
- 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, na, na, na, na, na> {
- 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, na, na, na, na> {
- 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, na, na, na> {
- 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, na, na> {
- 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, na> {
- 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 detail
 
 } // namespace units
 

Modified: sandbox/units/boost/units/make_system.hpp
==============================================================================
--- sandbox/units/boost/units/make_system.hpp (original)
+++ sandbox/units/boost/units/make_system.hpp 2007-06-04 14:15:00 EDT (Mon, 04 Jun 2007)
@@ -8,71 +8,39 @@
 // 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
+#ifndef BOOST_UNITS_MAKE_SYSTEM_HPP
+#define BOOST_UNITS_MAKE_SYSTEM_HPP
 
 #include <boost/mpl/list/list10.hpp>
 
 #include <boost/units/config.hpp>
-#include <boost/units/static_rational.hpp>
+#include <boost/units/homogeneous_system.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/detail/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;
-};
+#ifdef BOOST_UNITS_DOXYGEN
 
 namespace detail {
 
-template<class System, class Dimensions>
-struct check_system;
+struct unspecified {};
 
-#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_ {
+/// Metafunction returning a homogeneous system that can
+/// represent any combination of the base units. There must
+/// be no way to represent any of the base units in terms
+/// of the others. make_system<foot_base_unit, meter_base_unit>::type
+/// is not allowed.
+template<class BaseUnit0, class BaseUnit1, class BaseUnit2, ..., class BaseUnitN>
+struct make_system
+{
+ typedef homogeneous_system<detail::unspecified> type;
 };
 
-#endif
-
-}
+#else
 
 struct na {};
 
@@ -91,70 +59,77 @@
 struct make_system;
 
 template<>
-struct make_system<> {
+struct make_system<>
+{
     typedef homogeneous_system<dimensionless_type> type;
 };
 
+// Codewarrior 9.2 doesn't like using the defaults. Need
+// to specify na explicitly.
 template<class T0>
-struct make_system<T0, na, na, na, na, na, na, na, na, na> {
+struct make_system<T0, na, na, na, na, na, na, na, na, na>
+{
     typedef homogeneous_system<dimension_list<T0, dimensionless_type> > type;
 };
 
 template<class T0, class T1>
-struct make_system<T0, T1, na, na, na, na, na, na, na, na> {
+struct make_system<T0, T1, na, na, na, na, na, na, na, na>
+{
     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, na, na, na, na, na, na, na> {
+struct make_system<T0, T1, T2, na, na, na, na, na, na, na>
+{
     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, na, na, na, na, na, na> {
+struct make_system<T0, T1, T2, T3, na, na, na, na, na, na>
+{
     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, na, na, na, na, na> {
+struct make_system<T0, T1, T2, T3, T4, na, na, na, na, na>
+{
     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, na, na, na, na> {
+struct make_system<T0, T1, T2, T3, T4, T5, na, na, na, na>
+{
     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, na, na, na> {
+struct make_system<T0, T1, T2, T3, T4, T5, T6, na, na, na>
+{
     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, na, na> {
+struct make_system<T0, T1, T2, T3, T4, T5, T6, T7, na, na>
+{
     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, na> {
+struct make_system<T0, T1, T2, T3, T4, T5, T6, T7, T8, na>
+{
     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 {
+struct make_system
+{
     typedef homogeneous_system<typename detail::bubble_sort<mpl::list10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::type> type;
 };
 
+#endif
+
 } // 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

Modified: sandbox/units/boost/units/quantity.hpp
==============================================================================
--- sandbox/units/boost/units/quantity.hpp (original)
+++ sandbox/units/boost/units/quantity.hpp 2007-06-04 14:15:00 EDT (Mon, 04 Jun 2007)
@@ -28,6 +28,7 @@
 #include <boost/units/unit.hpp>
 #include <boost/units/units_fwd.hpp>
 #include <boost/units/conversion.hpp>
+#include <boost/units/homogeneous_system.hpp>
 
 namespace boost {
 

Modified: sandbox/units/boost/units/unit.hpp
==============================================================================
--- sandbox/units/boost/units/unit.hpp (original)
+++ sandbox/units/boost/units/unit.hpp 2007-06-04 14:15:00 EDT (Mon, 04 Jun 2007)
@@ -11,13 +11,15 @@
 #ifndef BOOST_UNITS_UNIT_HPP
 #define BOOST_UNITS_UNIT_HPP
 
+#include <boost/static_assert.hpp>
 #include <boost/mpl/bool_fwd.hpp>
 
+#include <boost/units/config.hpp>
 #include <boost/units/dimension.hpp>
 #include <boost/units/units_fwd.hpp>
+#include <boost/units/homogeneous_system.hpp>
 #include <boost/units/heterogeneous_system.hpp>
 #include <boost/units/detail/unit_impl.hpp>
-#include <boost/units/make_system.hpp>
 
 namespace boost {
 
@@ -60,66 +62,6 @@
 
 namespace units {
 
-/// class to specialize for IO
-//template<class SystemTag,class DimensionTag> struct unit_info;
-//
-///// utility class to simplify construction of dimensionless units in a system
-//template<class System>
-//struct dimensionless_unit
-//{
-// typedef unit<dimensionless_type,System> type;
-//};
-//
-//template<class T>
-//struct is_unit :
-// public mpl::false_
-//{ };
-//
-///// check that a type is a unit
-//template<class Dim,class System>
-//struct is_unit< unit<Dim,System> > :
-// public mpl::true_
-//{ };
-//
-//template<class T,class System>
-//struct is_unit_of_system :
-// public mpl::false_
-//{ };
-//
-//template<class T,class Dim>
-//struct is_unit_of_dimension :
-// public mpl::false_
-//{ };
-//
-///// check that a type is a unit of the specified dimension
-//template<class Dim,class System>
-//struct is_unit_of_dimension< unit<Dim,System>,Dim > :
-// public mpl::true_
-//{ };
-//
-///// check that a type is a dimensionless unit
-//template<class T>
-//struct is_dimensionless_unit :
-// public is_unit_of_dimension<T,dimensionless_type>
-//{ };
-//
-///// check that a type is a unit in a specified system
-//template<class Dim,class System>
-//struct is_unit_of_system< unit<Dim,System>,System > :
-// public mpl::true_
-//{ };
-
-//template<class T>
-//struct is_dimensionless :
-// public mpl::false_
-//{ };
-//
-///// check if a unit is dimensionless
-//template<class System>
-//struct is_dimensionless< unit<dimensionless_type,System> > :
-// public mpl::true_
-//{ };
-
 //template<class S1,class S2> struct is_implicitly_convertible;
 
 #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION
@@ -137,95 +79,18 @@
 
 #endif
 
-///// Determine if two homogeneous units are implicitly convertible
-//template<class S1,
-// class S2,
-// class Dim1>
-//struct is_implicitly_convertible< unit<Dim1,homogeneous_system<S1> >,
-// unit<Dim1,homogeneous_system<S2> > > :
-// mpl::bool_<detail::implicit_conversion_homo_to_homo_impl<mpl::size<Dim1>::value>::template
-// apply<typename mpl::begin<Dim1>::type, homogeneous_system<S1>, homogeneous_system<S2> >::value>
-//{
-// typedef homogeneous_system<S1> system1_type;
-// typedef homogeneous_system<S2> system2_type;
-//};
-//
-///// Determine if a homogeneous unit is implicitly convertible to a heterogeneous unit
-//template<class S1,
-// class S2,
-// class Dim1>
-//struct is_implicitly_convertible< unit<Dim1,homogeneous_system<S1> >,
-// unit<Dim1,heterogeneous_system<S2> > > :
-// mpl::false_
-//{
-// typedef homogeneous_system<S1> system1_type;
-// typedef heterogeneous_system<S2> system2_type;
-//};
-//
-///// Determine if a heterogeneous unit is implicitly convertible to a homogeneous unit
-//template<class S1,
-// class S2,
-// class Dim1>
-//struct is_implicitly_convertible< unit<Dim1,heterogeneous_system<S1> >,
-// unit<Dim1,homogeneous_system<S2> > > :
-// mpl::false_
-//{
-// typedef heterogeneous_system<S1> system1_type;
-// typedef homogeneous_system<S2> system2_type;
-//};
-//
-///// Determine if two heterogeneous units are implicitly convertible
-//template<class S1,
-// class S2,
-// class Dim1>
-//struct is_implicitly_convertible< unit<Dim1,heterogeneous_system<S1> >,
-// unit<Dim1,heterogeneous_system<S2> > > :
-// //mpl::and_<
-// // is_implicitly_convertible<
-// // unit<Dim1,heterogeneous_system<S1> >,
-// // unit<Dim1,homogeneous_system<typename mpl::front<typename system1_type::type>::type::tag_type> >
-// // >,
-// // is_implicitly_convertible<
-// // unit<Dim1,homogeneous_system<typename mpl::front<typename system1_type::type>::type::tag_type> >,
-// // unit<Dim1,heterogeneous_system<S2> >
-// // >
-// //>
-// mpl::false_
-//{
-// typedef heterogeneous_system<S1> system1_type;
-// typedef heterogeneous_system<S2> system2_type;
-//};
-
-//template<class T> struct get_dimension;
-//
-///// get the dimension of a unit
-//template<class Dim,class System>
-//struct get_dimension< unit<Dim,System> >
-//{
-// typedef Dim type;
-//};
-
-//template<class T> struct get_system;
-//
-///// get the system of a unit
-//template<class Dim,class System>
-//struct get_system< unit<Dim,System> >
-//{
-// typedef System type;
-//};
-
 /// unit unary plus typeof helper
 template<class Dim,class System>
 struct unary_plus_typeof_helper< unit<Dim,System> >
 {
- typedef unit<typename make_dimension_list<Dim>::type,System> type;
+ typedef unit<Dim,System> type;
 };
 
 /// unit unary minus typeof helper
 template<class Dim,class System>
 struct unary_minus_typeof_helper< unit<Dim,System> >
 {
- typedef unit<typename make_dimension_list<Dim>::type,System> type;
+ typedef unit<Dim,System> type;
 };
 
 /// unit add typeof helper
@@ -237,7 +102,7 @@
     // ensure dimension lists are commensurate
     BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true));
 
- typedef unit<typename make_dimension_list<Dim1>::type,System> type;
+ typedef unit<Dim1,System> type;
 };
 
 /// unit subtract typeof helper
@@ -249,7 +114,7 @@
     // ensure dimension lists are commensurate
     BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true));
 
- typedef unit<typename make_dimension_list<Dim1>::type,System> type;
+ typedef unit<Dim1,System> type;
 };
 
 /// unit multiply typeof helper for two identical homogeneous systems


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