Boost logo

Boost-Commit :

From: steven_watanabe_at_[hidden]
Date: 2007-06-02 14:22:43


Author: steven_watanabe
Date: 2007-06-02 14:22:42 EDT (Sat, 02 Jun 2007)
New Revision: 4420
URL: http://svn.boost.org/trac/boost/changeset/4420

Log:
msvc7.1 and cw9.2 are happy now

Text files modified:
   sandbox/units/boost/units/make_system.hpp | 19 ++++++++++---------
   sandbox/units/boost/units/quantity.hpp | 21 +++++++++++++++++----
   sandbox/units/libs/units/example/unit_example_22.cpp | 1 +
   3 files changed, 28 insertions(+), 13 deletions(-)

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-02 14:22:42 EDT (Sat, 02 Jun 2007)
@@ -14,6 +14,7 @@
 #include <boost/mpl/list/list10.hpp>
 
 #include <boost/units/config.hpp>
+#include <boost/units/static_rational.hpp>
 #include <boost/units/detail/sort.hpp>
 
 #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
@@ -95,47 +96,47 @@
 };
 
 template<class T0>
-struct make_system<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> {
+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> {
+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> {
+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> {
+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> {
+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> {
+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> {
+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> {
+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;
 };
 

Modified: sandbox/units/boost/units/quantity.hpp
==============================================================================
--- sandbox/units/boost/units/quantity.hpp (original)
+++ sandbox/units/boost/units/quantity.hpp 2007-06-02 14:22:42 EDT (Sat, 02 Jun 2007)
@@ -61,6 +61,15 @@
 template<>
 struct is_non_narrowing_conversion<long double, double> : mpl::false_ {};
 
+// msvc 7.1 needs extra disambiguation
+template<class T, class U>
+struct disable_if_is_same {
+ typedef void type;
+};
+
+template<class T>
+struct disable_if_is_same<T, T> {};
+
 }
  
 /// class declaration
@@ -149,7 +158,8 @@
                         //units are not convertible at all
                         typename is_implicitly_convertible<Unit2,Unit>::type,
                         detail::is_non_narrowing_conversion<YY, Y>
- >
+ >,
+ typename detail::disable_if_is_same<Unit, Unit2>::type
>::type* = 0)
              : val_(conversion_helper<quantity<Unit2,YY>,this_type>::convert(source).value())
         {
@@ -164,7 +174,8 @@
                      mpl::and_<
                          typename is_implicitly_convertible<Unit2,Unit>::type,
                          detail::is_non_narrowing_conversion<YY, Y>
- >
+ >,
+ typename detail::disable_if_is_same<Unit, Unit2>::type
>::type* = 0)
              : val_(conversion_helper<quantity<Unit2,YY>,this_type>::convert(source).value())
         {
@@ -339,7 +350,8 @@
         /// implicit conversion between different unit systems is allowed
         template<class System2, class Y2>
         quantity(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y2>& source,
- typename boost::enable_if<detail::is_non_narrowing_conversion<Y2, Y> >::type* = 0) :
+ typename boost::enable_if<detail::is_non_narrowing_conversion<Y2, Y>,
+ typename detail::disable_if_is_same<SystemTag, System2>::type>::type* = 0) :
             val_(source.value())
         {
             BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
@@ -348,7 +360,8 @@
         /// implicit conversion between different unit systems is allowed
         template<class System2, class Y2>
         explicit quantity(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y2>& source,
- typename boost::disable_if<detail::is_non_narrowing_conversion<Y2, Y> >::type* = 0) :
+ typename boost::disable_if<detail::is_non_narrowing_conversion<Y2, Y>,
+ typename detail::disable_if_is_same<SystemTag, System2>::type>::type* = 0) :
             val_(static_cast<Y>(source.value()))
         {
             BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);

Modified: sandbox/units/libs/units/example/unit_example_22.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_22.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_22.cpp 2007-06-02 14:22:42 EDT (Sat, 02 Jun 2007)
@@ -29,6 +29,7 @@
 
 #include <iostream>
 
+#include <boost/units/cmath.hpp>
 #include <boost/units/io.hpp>
 #include <boost/units/quantity.hpp>
 #include <boost/units/systems/cgs/acceleration.hpp>


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