Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31109
Modified Files:
operators.hpp quantity.hpp
Log Message:
minor changes to simplify testing w/wo typeof support
Index: operators.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/operators.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- operators.hpp 16 Mar 2007 18:12:42 -0000 1.1.1.1
+++ operators.hpp 3 Apr 2007 19:25:08 -0000 1.2
@@ -18,15 +18,20 @@
#include <boost/version.hpp>
#include <boost/type_traits/is_same.hpp>
+#if (BOOST_VERSION >= 103400)
+ #define BOOST_UNITS_HAS_BOOST_TYPEOF 1
+#else
+ #define BOOST_UNITS_HAS_BOOST_TYPEOF 0
+#endif
+
// uncomment this to test without Boost Typeof
-//#undef BOOST_VERSION
-//#define BOOST_VERSION 103300
+//#undef BOOST_UNITS_HAS_BOOST_TYPEOF
+//#define BOOST_UNITS_HAS_BOOST_TYPEOF 0
-#if (BOOST_VERSION >= 103400)
+#if (BOOST_UNITS_HAS_BOOST_TYPEOF)
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/complex.hpp>
#define BOOST_UNITS_HAS_TYPEOF 1
- #define BOOST_UNITS_HAS_BOOST_TYPEOF 1
#else
#if (__GNUC__ && __cplusplus && __GNUC__ >= 3)
#define BOOST_UNITS_HAS_TYPEOF 1
@@ -86,7 +91,7 @@
} // namespace typeof_
-#if BOOST_UNITS_HAS_BOOST_TYPEOF
+#if (BOOST_UNITS_HAS_TYPEOF && BOOST_UNITS_HAS_BOOST_TYPEOF)
template<typename X> struct unary_plus_typeof_helper
{
@@ -124,7 +129,7 @@
typedef typename nested::type type;
};
-#elif BOOST_UNITS_HAS_MWERKS_TYPEOF
+#elif (BOOST_UNITS_HAS_TYPEOF && BOOST_UNITS_HAS_MWERKS_TYPEOF)
template<typename X> struct unary_plus_typeof_helper { typedef __typeof__((+typeof_::make<X>())) type; };
template<typename X> struct unary_minus_typeof_helper { typedef __typeof__((-typeof_::make<X>())) type; };
@@ -134,7 +139,7 @@
template<typename X,typename Y> struct multiply_typeof_helper { typedef __typeof__((typeof_::make<X>()*typeof_::make<Y>())) type; };
template<typename X,typename Y> struct divide_typeof_helper { typedef __typeof__((typeof_::make<X>()/typeof_::make<Y>())) type; };
-#elif BOOST_UNITS_HAS_GNU_TYPEOF
+#elif (BOOST_UNITS_HAS_TYPEOF && BOOST_UNITS_HAS_GNU_TYPEOF)
template<typename X> struct unary_plus_typeof_helper { typedef typeof((+typeof_::make<X>())) type; };
template<typename X> struct unary_minus_typeof_helper { typedef typeof((-typeof_::make<X>())) type; };
Index: quantity.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- quantity.hpp 3 Apr 2007 18:24:37 -0000 1.11
+++ quantity.hpp 3 Apr 2007 19:25:08 -0000 1.12
@@ -76,7 +76,6 @@
template<class System2,class Dim2,class YY>
explicit
quantity(const quantity<unit<Dim2,System2>,YY>& source,
-// typename boost::disable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0)
typename boost::disable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit_type>::type>::type* = 0)
: val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value())
{
@@ -86,7 +85,6 @@
/// implicit conversion between different unit systems is allowed if each fundamental dimension is implicitly convertible
template<class System2,class Dim2,class YY>
quantity(const quantity<unit<Dim2,System2>,YY>& source,
-// typename boost::enable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0)
typename boost::enable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit_type>::type>::type* = 0)
: val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value())
{
@@ -174,14 +172,14 @@
quantity(const quantity<unit<dimension_type,system_type>,YY>& source) :
val_(source.value())
{
- BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true));
+ BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true));
}
/// implicit assignment between value types is allowed if allowed for value types themselves
template<class YY>
this_type& operator=(const quantity<unit<dimension_type,system_type>,YY>& source)
{
- BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true));
+ BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true));
*this = this_type(source);
@@ -225,9 +223,9 @@
value_type val_;
};
-}
+} // namespace units
-}
+} // namespace boost
#if BOOST_UNITS_HAS_BOOST_TYPEOF
|