Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58267 - in sandbox/chrono/boost: . chrono
From: vicente.botet_at_[hidden]
Date: 2009-12-10 08:25:29


Author: viboes
Date: 2009-12-10 08:25:28 EST (Thu, 10 Dec 2009)
New Revision: 58267
URL: http://svn.boost.org/trac/boost/changeset/58267

Log:
Boost.Chrono: Version 0.2.2, Bug fixes
* Commenting invalid operator declarations

Text files modified:
   sandbox/chrono/boost/chrono/chrono.hpp | 165 +++++++++++++++++++++------------------
   sandbox/chrono/boost/ratio.hpp | 10 +-
   2 files changed, 92 insertions(+), 83 deletions(-)

Modified: sandbox/chrono/boost/chrono/chrono.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/chrono.hpp (original)
+++ sandbox/chrono/boost/chrono/chrono.hpp 2009-12-10 08:25:28 EST (Thu, 10 Dec 2009)
@@ -121,10 +121,13 @@
     };
 
     template <class Duration, class Rep2,
- bool = boost::is_convertible<typename Duration::rep,
- typename common_type<typename Duration::rep, Rep2>::type>::value
- && boost::is_convertible<Rep2,
- typename common_type<typename Duration::rep, Rep2>::type>::value>
+ bool = (
+ boost::is_convertible<typename Duration::rep,
+ typename common_type<typename Duration::rep, Rep2>::type>::value
+ && boost::is_convertible<Rep2,
+ typename common_type<typename Duration::rep, Rep2>::type>::value
+ )
+ >
     struct duration_divide_imp
     {
     };
@@ -161,52 +164,52 @@
   template <class Rep> struct duration_values;
 
   // duration arithmetic
- template <class Rep1, class Period1, class Rep2, class Period2>
- typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
- operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- template <class Rep1, class Period1, class Rep2, class Period2>
- typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
- operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- template <class Rep1, class Period, class Rep2>
- typename boost::enable_if_c
- <
- boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
- && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
- duration<typename common_type<Rep1, Rep2>::type, Period>
- >::type
- operator*(const duration<Rep1, Period>& d, const Rep2& s);
- template <class Rep1, class Period, class Rep2>
- typename boost::enable_if_c
- <
- boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
- && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
- duration<typename common_type<Rep1, Rep2>::type, Period>
- >::type
- operator*(const Rep1& s, const duration<Rep2, Period>& d);
-
- template <class Rep1, class Period, class Rep2>
- typename boost::disable_if <detail::is_duration<Rep2>,
- typename detail::duration_divide_result<duration<Rep1, Period>, Rep2>::type
- >::type
- operator/(const duration<Rep1, Period>& d, const Rep2& s);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
+// operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
+// operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period, class Rep2>
+// typename boost::enable_if_c
+// <
+// boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
+// && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// >::type
+// operator*(const duration<Rep1, Period>& d, const Rep2& s);
+// template <class Rep1, class Period, class Rep2>
+// typename boost::enable_if_c
+// <
+// boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
+// && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
+// duration<typename common_type<Rep1, Rep2>::type, Period>
+// >::type
+// operator*(const Rep1& s, const duration<Rep2, Period>& d);
+
+// template <class Rep1, class Period, class Rep2>
+// typename boost::disable_if <detail::is_duration<Rep2>,
+// typename detail::duration_divide_result<duration<Rep1, Period>, Rep2>::type
+// >::type
+// operator/(const duration<Rep1, Period>& d, const Rep2& s);
   
- template <class Rep1, class Period1, class Rep2, class Period2>
- typename common_type<Rep1, Rep2>::type
- operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// typename common_type<Rep1, Rep2>::type
+// operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
 
   // duration comparisons
- template <class Rep1, class Period1, class Rep2, class Period2>
- bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- template <class Rep1, class Period1, class Rep2, class Period2>
- bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- template <class Rep1, class Period1, class Rep2, class Period2>
- bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- template <class Rep1, class Period1, class Rep2, class Period2>
- bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- template <class Rep1, class Period1, class Rep2, class Period2>
- bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- template <class Rep1, class Period1, class Rep2, class Period2>
- bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+// template <class Rep1, class Period1, class Rep2, class Period2>
+// bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
 
   // duration_cast
 
@@ -472,13 +475,15 @@
         BOOST_CONSTEXPR duration() {} // = default;
         template <class Rep2>
         BOOST_CONSTEXPR explicit duration(const Rep2& r,
- typename boost::enable_if_c
- <
- boost::is_convertible<Rep2, rep>::value
- && (treat_as_floating_point<rep>::value
- || (!treat_as_floating_point<rep>::value
- && !treat_as_floating_point<Rep2>::value))
- >::type* = 0)
+ typename boost::enable_if_c
+ <
+ ( boost::is_convertible<Rep2, rep>::value
+ && (treat_as_floating_point<rep>::value
+ || ( !treat_as_floating_point<rep>::value
+ && !treat_as_floating_point<Rep2>::value)
+ )
+ )
+ >::type* = 0)
                   : rep_(r) {}
         ~duration() {} //= default;
         duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
@@ -491,12 +496,13 @@
         // conversions
         template <class Rep2, class Period2>
         BOOST_CONSTEXPR duration(const duration<Rep2, Period2>& d,
- typename boost::enable_if_c
- <
- treat_as_floating_point<rep>::value
- || (ratio_divide<Period2, period>::type::den == 1
- && !treat_as_floating_point<Rep2>::value)
- >::type* = 0)
+ typename boost::enable_if_c
+ <
+ ( treat_as_floating_point<rep>::value
+ || ( ratio_divide<Period2, period>::type::den == 1
+ && !treat_as_floating_point<Rep2>::value)
+ )
+ >::type* = 0)
 #ifdef __GNUC__
             // GCC 4.2.4 refused to accept a definition at this point,
             // yet both VC++ 9.0 SP1 and Intel ia32 11.0 accepted the definition
@@ -570,10 +576,11 @@
   template <class Rep1, class Period, class Rep2>
   inline
   typename boost::enable_if_c
- <
- boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
- && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
- duration<typename common_type<Rep1, Rep2>::type, Period>
+ <
+ ( boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
+ && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value
+ ),
+ duration<typename common_type<Rep1, Rep2>::type, Period>
>::type
   operator*(const duration<Rep1, Period>& d, const Rep2& s)
   {
@@ -586,10 +593,11 @@
   template <class Rep1, class Period, class Rep2>
   inline
   typename boost::enable_if_c
- <
- boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
- && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
- duration<typename common_type<Rep1, Rep2>::type, Period>
+ <
+ ( boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
+ && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value
+ ),
+ duration<typename common_type<Rep1, Rep2>::type, Period>
>::type
   operator*(const Rep1& s, const duration<Rep2, Period>& d)
   {
@@ -990,16 +998,17 @@
 //----------------------------------------------------------------------------//
 
 #ifdef __GNUC__
- // see comment above in section 20.9.3 Class template duration [time.duration]
- template <class Rep, class Period>
- template <class Rep2, class Period2>
- BOOST_CONSTEXPR duration<Rep, Period>::duration(const duration<Rep2, Period2>& d,
- typename boost::enable_if_c
- <
- treat_as_floating_point<rep>::value
- || (ratio_divide<Period2, period>::type::den == 1
- && !treat_as_floating_point<Rep2>::value)
- >::type*)
+ // see comment above in section 20.9.3 Class template duration [time.duration]
+ template <class Rep, class Period>
+ template <class Rep2, class Period2>
+ BOOST_CONSTEXPR duration<Rep, Period>::duration(const duration<Rep2, Period2>& d,
+ typename boost::enable_if_c
+ <
+ ( treat_as_floating_point<rep>::value
+ || ( ratio_divide<Period2, period>::type::den == 1
+ && !treat_as_floating_point<Rep2>::value)
+ )
+ >::type*)
           : rep_(duration_cast<duration>(d).count()) {}
 #endif
 

Modified: sandbox/chrono/boost/ratio.hpp
==============================================================================
--- sandbox/chrono/boost/ratio.hpp (original)
+++ sandbox/chrono/boost/ratio.hpp 2009-12-10 08:25:28 EST (Thu, 10 Dec 2009)
@@ -292,15 +292,15 @@
     ratio(const ratio<_N2, _D2>&,
         typename enable_if_c
             <
- ratio<_N2, _D2>::num == num &&
- ratio<_N2, _D2>::den == den
+ (ratio<_N2, _D2>::num == num &&
+ ratio<_N2, _D2>::den == den)
>::type* = 0) {}
     
     template <intmax_t _N2, intmax_t _D2>
         typename enable_if_c
         <
- ratio<_N2, _D2>::num == num &&
- ratio<_N2, _D2>::den == den,
+ (ratio<_N2, _D2>::num == num &&
+ ratio<_N2, _D2>::den == den),
             ratio&
>::type
     operator=(const ratio<_N2, _D2>&) {return *this;}
@@ -422,7 +422,7 @@
 template <class R1, class R2>
 struct ratio_equal
     : public boost::integral_constant<bool,
- R1::num == R2::num && R1::den == R2::den> {};
+ (R1::num == R2::num && R1::den == R2::den)> {};
 
 template <class R1, class R2>
 struct ratio_not_equal


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