Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49997 - trunk/boost/units/detail
From: steven_at_[hidden]
Date: 2008-11-28 15:08:08


Author: steven_watanabe
Date: 2008-11-28 15:08:07 EST (Fri, 28 Nov 2008)
New Revision: 49997
URL: http://svn.boost.org/trac/boost/changeset/49997

Log:
Remove SFINAE in BOOST_UNITS_DIMENSIONLESS_UNIT to hopefully fix the vacpp failures
Text files modified:
   trunk/boost/units/detail/dimensionless_unit.hpp | 51 +++++++++++++++++++++------------------
   1 files changed, 27 insertions(+), 24 deletions(-)

Modified: trunk/boost/units/detail/dimensionless_unit.hpp
==============================================================================
--- trunk/boost/units/detail/dimensionless_unit.hpp (original)
+++ trunk/boost/units/detail/dimensionless_unit.hpp 2008-11-28 15:08:07 EST (Fri, 28 Nov 2008)
@@ -11,7 +11,6 @@
 #ifndef BOOST_UNITS_DETAIL_DIMENSIONLESS_UNIT_HPP
 #define BOOST_UNITS_DETAIL_DIMENSIONLESS_UNIT_HPP
 
-#include <boost/utility/enable_if.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
 
@@ -29,14 +28,18 @@
 
 namespace detail {
 
-template<class T>
-struct is_dimensionless_system : boost::mpl::false_ {};
+template<class System>
+struct void_if_dimensionless {
+ typedef int type;
+};
 
 template<class T>
-struct is_dimensionless_system<boost::units::homogeneous_system<T> > : boost::mpl::true_ {};
+struct void_if_dimensionless<boost::units::homogeneous_system<T> > {
+ typedef void type;
+};
 
 template<>
-struct is_dimensionless_system<
+struct void_if_dimensionless<
    boost::units::heterogeneous_system<
        boost::units::heterogeneous_system_impl<
            boost::units::dimensionless_type,
@@ -44,40 +47,40 @@
            boost::units::dimensionless_type
>
>
-> : boost::mpl::true_ {};
+> {
+ typedef void type;
+};
+
+template<class System, class Test = void>
+struct void_if_heterogeneous {
+ typedef void type;
+};
+
+template<class System>
+struct void_if_heterogeneous<System, typename void_if_dimensionless<System>::type> {
+ typedef int type;
+};
 
-#ifdef BOOST_MSVC
+template<class System, class Enable=void>
+struct is_dimensionless_system : mpl::false_ {};
 
-#define BOOST_UNITS_DIMENSIONLESS_UNIT(T)\
- boost::units::unit<\
- typename boost::enable_if<boost::units::detail::is_dimensionless_system<T>, boost::units::dimensionless_type>::type,\
- T\
- >
-
-#define BOOST_UNITS_HETEROGENEOUS_DIMENSIONLESS_UNIT(T)\
- boost::units::unit<\
- typename boost::disable_if<boost::units::detail::is_dimensionless_system<T>, boost::units::dimensionless_type>::type,\
- T\
- >
-
-#else
+template<class System>
+struct is_dimensionless_system<System, typename void_if_dimensionless<System>::type> : mpl::true_ {};
 
 #define BOOST_UNITS_DIMENSIONLESS_UNIT(T)\
     boost::units::unit<\
         boost::units::dimensionless_type,\
         T,\
- typename boost::enable_if<boost::units::detail::is_dimensionless_system<T> >::type\
+ typename ::boost::units::detail::void_if_dimensionless<T>::type\
>
 
 #define BOOST_UNITS_HETEROGENEOUS_DIMENSIONLESS_UNIT(T)\
     boost::units::unit<\
         boost::units::dimensionless_type,\
         T,\
- typename boost::disable_if<boost::units::detail::is_dimensionless_system<T> >::type\
+ typename ::boost::units::detail::void_if_heterogeneous<T>::type\
>
 
-#endif
-
 }
 }
 }


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