Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69227 - in trunk/boost/chrono: . detail detail/inlined/win
From: DDeakins_at_[hidden]
Date: 2011-02-23 17:50:28


Author: davedeakins
Date: 2011-02-23 17:50:26 EST (Wed, 23 Feb 2011)
New Revision: 69227
URL: http://svn.boost.org/trac/boost/changeset/69227

Log:
Changes to resolve VC9 compiler errors
Added:
   trunk/boost/chrono/detail/is_evenly_divisible_by.hpp (contents, props changed)
Text files modified:
   trunk/boost/chrono/detail/inlined/win/chrono.hpp | 7 ------
   trunk/boost/chrono/duration.hpp | 41 +++------------------------------------
   trunk/boost/chrono/time_point.hpp | 3 --
   3 files changed, 4 insertions(+), 47 deletions(-)

Modified: trunk/boost/chrono/detail/inlined/win/chrono.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/win/chrono.hpp (original)
+++ trunk/boost/chrono/detail/inlined/win/chrono.hpp 2011-02-23 17:50:26 EST (Wed, 23 Feb 2011)
@@ -52,15 +52,8 @@
                         "chrono::steady_clock" ));
     }
 
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
- // trying to simplify expression (Pb. with MSVC.9.0)
- steady_clock::rep r = static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart);
- steady_clock::duration d(r);
- return steady_clock::time_point(d);
-#else
     return steady_clock::time_point(steady_clock::duration(
       static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart)));
-#endif
   }
 
 

Added: trunk/boost/chrono/detail/is_evenly_divisible_by.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/chrono/detail/is_evenly_divisible_by.hpp 2011-02-23 17:50:26 EST (Wed, 23 Feb 2011)
@@ -0,0 +1,29 @@
+// is_evenly_divisible_by.hpp --------------------------------------------------------------//
+
+// Copyright 2009-2010 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#ifndef BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP
+#define BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/mpl/logical.hpp>
+#include <boost/ratio/ratio.hpp>
+
+
+namespace boost {
+namespace chrono {
+namespace chrono_detail {
+
+ template <class R1, class R2>
+ struct is_evenly_divisible_by : public boost::mpl::bool_ < ratio_divide<R1, R2>::type::den == 1 >
+ {};
+
+} // namespace chrono_detail
+} // namespace detail
+} // namespace chrono
+
+#endif // BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP

Modified: trunk/boost/chrono/duration.hpp
==============================================================================
--- trunk/boost/chrono/duration.hpp (original)
+++ trunk/boost/chrono/duration.hpp 2011-02-23 17:50:26 EST (Wed, 23 Feb 2011)
@@ -43,6 +43,7 @@
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/type_traits/is_floating_point.hpp>
 #include <boost/type_traits/is_unsigned.hpp>
+#include <boost/chrono/detail/is_evenly_divisible_by.hpp>
 
 #include <boost/cstdint.hpp>
 #include <boost/utility/enable_if.hpp>
@@ -432,8 +433,6 @@
         template <class Rep2>
         BOOST_CHRONO_CONSTEXPR
         explicit duration(const Rep2& r
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
-#else
         , typename boost::enable_if <
                     mpl::and_ <
                         boost::is_convertible<Rep2, rep>,
@@ -446,8 +445,7 @@
>
>
>::type* = 0
-#endif
- )
+ )
                   : rep_(r) { }
         ~duration() {} //= default;
         duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
@@ -461,19 +459,16 @@
         template <class Rep2, class Period2>
         BOOST_CHRONO_CONSTEXPR
         duration(const duration<Rep2, Period2>& d
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
-#else
         , typename boost::enable_if <
                     mpl::or_ <
                         treat_as_floating_point<rep>,
                         mpl::and_ <
- mpl::bool_ < ratio_divide<Period2, period>::type::den == 1>,
+ chrono_detail::is_evenly_divisible_by<Period2, period>,
                             mpl::not_ < treat_as_floating_point<Rep2> >
>
>
>::type* = 0
-#endif
- )
+ )
             : rep_(chrono::detail::duration_cast<duration<Rep2, Period2>, duration>()(d).count()) {}
 
         // observer
@@ -560,9 +555,6 @@
 
     template <class Rep1, class Period, class Rep2>
     inline
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
- duration<typename common_type<Rep1, Rep2>::type, Period>
-#else
     typename boost::enable_if <
         mpl::and_ <
         boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>,
@@ -570,7 +562,6 @@
>,
         duration<typename common_type<Rep1, Rep2>::type, Period>
>::type
-#endif
     operator*(const duration<Rep1, Period>& d, const Rep2& s)
     {
         typedef typename common_type<Rep1, Rep2>::type CR;
@@ -581,9 +572,6 @@
 
     template <class Rep1, class Period, class Rep2>
     inline
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
- duration<typename common_type<Rep1, Rep2>::type, Period>
-#else
     typename boost::enable_if <
         mpl::and_ <
         boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>,
@@ -591,7 +579,6 @@
>,
         duration<typename common_type<Rep1, Rep2>::type, Period>
>::type
-#endif
     operator*(const Rep1& s, const duration<Rep2, Period>& d)
     {
         return d * s;
@@ -676,15 +663,7 @@
         bool operator()(const LhsDuration& lhs, const RhsDuration& rhs)
         {
             typedef typename common_type<LhsDuration, RhsDuration>::type CD;
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
- // trying to simplify expression so enable_if is not used (Pb. with MSVC.9.0)
- return
- chrono::detail::duration_cast<LhsDuration, CD>()(lhs).count()
- ==
- chrono::detail::duration_cast<RhsDuration, CD>()(rhs).count();
-#else
             return CD(lhs).count() == CD(rhs).count();
-#endif
         }
     };
 
@@ -703,15 +682,7 @@
         bool operator()(const LhsDuration& lhs, const RhsDuration& rhs)
         {
             typedef typename common_type<LhsDuration, RhsDuration>::type CD;
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
- // trying to simplify expression so enable_if is not used (Pb. with MSVC.9.0)
- return
- chrono::detail::duration_cast<LhsDuration, CD>()(lhs).count()
- <
- chrono::detail::duration_cast<RhsDuration, CD>()(rhs).count();
-#else
             return CD(lhs).count() < CD(rhs).count();
-#endif
         }
     };
 
@@ -801,12 +772,8 @@
     // Compile-time select the most efficient algorithm for the conversion...
     template <class ToDuration, class Rep, class Period>
     inline BOOST_CHRONO_CONSTEXPR
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
- ToDuration
-#else
     typename boost::enable_if <
       boost::chrono::detail::is_duration<ToDuration>, ToDuration>::type
-#endif
     duration_cast(const duration<Rep, Period>& fd)
     {
         return boost::chrono::detail::duration_cast<

Modified: trunk/boost/chrono/time_point.hpp
==============================================================================
--- trunk/boost/chrono/time_point.hpp (original)
+++ trunk/boost/chrono/time_point.hpp 2011-02-23 17:50:26 EST (Wed, 23 Feb 2011)
@@ -170,13 +170,10 @@
         template <class Duration2>
         BOOST_CHRONO_CONSTEXPR
         time_point(const time_point<clock, Duration2>& t
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
-#else
                 , typename boost::enable_if
                 <
                     boost::is_convertible<Duration2, duration>
>::type* = 0
-#endif
         )
             : d_(t.time_since_epoch())
         {


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