Boost logo

Boost-Commit :

From: steven_at_[hidden]
Date: 2007-10-12 13:24:57


Author: steven_watanabe
Date: 2007-10-12 13:24:56 EDT (Fri, 12 Oct 2007)
New Revision: 39965
URL: http://svn.boost.org/trac/boost/changeset/39965

Log:
Rearranged SFINAE. Hopefully this will help cw...
Text files modified:
   sandbox/units/boost/units/detail/dimensionless_unit.hpp | 43 ++++++++++++++++++++++++++++++++++++---
   sandbox/units/boost/units/implicit_conversion.hpp | 4 --
   sandbox/units/boost/units/scaled_base_unit.hpp | 7 -----
   sandbox/units/boost/units/unit.hpp | 2
   sandbox/units/boost/units/units_fwd.hpp | 2
   5 files changed, 43 insertions(+), 15 deletions(-)

Modified: sandbox/units/boost/units/detail/dimensionless_unit.hpp
==============================================================================
--- sandbox/units/boost/units/detail/dimensionless_unit.hpp (original)
+++ sandbox/units/boost/units/detail/dimensionless_unit.hpp 2007-10-12 13:24:56 EDT (Fri, 12 Oct 2007)
@@ -14,11 +14,19 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/units/units_fwd.hpp>
-#include <boost/units/heterogeneous_system.hpp>
-#include <boost/units/homogeneous_system.hpp>
 
 namespace boost {
 namespace units {
+
+template<class T>
+struct heterogeneous_system;
+
+template<class T>
+struct homogeneous_system;
+
+template<class T1, class T2>
+struct heterogeneous_system_pair;
+
 namespace detail {
 
 template<class T>
@@ -37,10 +45,37 @@
>
> : boost::mpl::true_ {};
 
+#ifdef BOOST_MSVC
+
 #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>
+ 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
 
-#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>
+#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\
+ >
+
+#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\
+ >
+
+#endif
 
 }
 }

Modified: sandbox/units/boost/units/implicit_conversion.hpp
==============================================================================
--- sandbox/units/boost/units/implicit_conversion.hpp (original)
+++ sandbox/units/boost/units/implicit_conversion.hpp 2007-10-12 13:24:56 EDT (Fri, 12 Oct 2007)
@@ -18,15 +18,13 @@
 #include <boost/mpl/bool.hpp>
 
 #include <boost/units/operators.hpp>
-
 #include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/units_fwd.hpp>
 
 namespace boost {
 
 namespace units {
 
-template<class Dim,class System> class unit;
-
 namespace detail {
 
 template<int N>

Modified: sandbox/units/boost/units/scaled_base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/scaled_base_unit.hpp (original)
+++ sandbox/units/boost/units/scaled_base_unit.hpp 2007-10-12 13:24:56 EDT (Fri, 12 Oct 2007)
@@ -27,6 +27,7 @@
 #include <boost/units/config.hpp>
 #include <boost/units/dimension.hpp>
 #include <boost/units/static_rational.hpp>
+#include <boost/units/units_fwd.hpp>
 #include <boost/units/detail/one.hpp>
 #include <boost/units/detail/static_rational_power.hpp>
 
@@ -34,9 +35,6 @@
 
 namespace units {
 
-template<class Dimensions, class System>
-class unit;
-
 template<class T>
 struct heterogeneous_system;
 
@@ -193,9 +191,6 @@
     typedef typename unscale<S>::type type;
 };
 
-template<class D, class S>
-class unit;
-
 /// INTERNAL ONLY
 template<class D, class S>
 struct unscale<unit<D, S> >

Modified: sandbox/units/boost/units/unit.hpp
==============================================================================
--- sandbox/units/boost/units/unit.hpp (original)
+++ sandbox/units/boost/units/unit.hpp 2007-10-12 13:24:56 EDT (Fri, 12 Oct 2007)
@@ -31,7 +31,7 @@
 /// class representing a model-dependent unit with no associated value
 
 /// (e.g. meters, Kelvin, feet, etc...)
-template<class Dim,class System>
+template<class Dim,class System, class Enable>
 class unit
 {
     public:

Modified: sandbox/units/boost/units/units_fwd.hpp
==============================================================================
--- sandbox/units/boost/units/units_fwd.hpp (original)
+++ sandbox/units/boost/units/units_fwd.hpp 2007-10-12 13:24:56 EDT (Fri, 12 Oct 2007)
@@ -32,7 +32,7 @@
 template<class T> struct get_dimension;
 template<class T> struct get_system;
 
-template<class Dim,class System> class unit;
+template<class Dim,class System, class Enable=void> class unit;
 template<class Y> class absolute;
 
 template<class BaseUnitTag> struct base_unit_info;


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