Ticket #5214: boost-chrono-vc9-conversion.patch
File boost-chrono-vc9-conversion.patch, 7.0 KB (added by , 12 years ago) |
---|
-
detail/inlined/win/chrono.hpp
52 52 "chrono::steady_clock" )); 53 53 } 54 54 55 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)56 // trying to simplify expression (Pb. with MSVC.9.0)57 steady_clock::rep r = static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart);58 steady_clock::duration d(r);59 return steady_clock::time_point(d);60 #else61 55 return steady_clock::time_point(steady_clock::duration( 62 56 static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart))); 63 #endif64 57 } 65 58 66 59 -
detail/is_evenly_divisible_by.hpp
1 // is_evenly_divisible_by.hpp --------------------------------------------------------------// 2 3 // Copyright 2009-2010 Vicente J. Botet Escriba 4 5 // Distributed under the Boost Software License, Version 1.0. 6 // See http://www.boost.org/LICENSE_1_0.txt 7 8 #ifndef BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP 9 #define BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP 10 11 #include <boost/chrono/config.hpp> 12 13 #include <boost/mpl/logical.hpp> 14 #include <boost/ratio/ratio.hpp> 15 16 17 namespace boost { 18 namespace chrono { 19 namespace chrono_detail { 20 21 template <class R1, class R2> 22 struct is_evenly_divisible_by : public boost::mpl::bool_ < ratio_divide<R1, R2>::type::den == 1 > 23 {}; 24 25 } // namespace chrono_detail 26 } // namespace detail 27 } // namespace chrono 28 29 #endif // BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP -
duration.hpp
43 43 #include <boost/type_traits/is_convertible.hpp> 44 44 #include <boost/type_traits/is_floating_point.hpp> 45 45 #include <boost/type_traits/is_unsigned.hpp> 46 #include <boost/chrono/detail/is_evenly_divisible_by.hpp> 46 47 47 48 #include <boost/cstdint.hpp> 48 49 #include <boost/utility/enable_if.hpp> … … 432 433 template <class Rep2> 433 434 BOOST_CHRONO_CONSTEXPR 434 435 explicit duration(const Rep2& r 435 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)436 #else437 436 , typename boost::enable_if < 438 437 mpl::and_ < 439 438 boost::is_convertible<Rep2, rep>, … … 446 445 > 447 446 > 448 447 >::type* = 0 449 #endif 450 ) 448 ) 451 449 : rep_(r) { } 452 450 ~duration() {} //= default; 453 451 duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; … … 461 459 template <class Rep2, class Period2> 462 460 BOOST_CHRONO_CONSTEXPR 463 461 duration(const duration<Rep2, Period2>& d 464 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)465 #else466 462 , typename boost::enable_if < 467 463 mpl::or_ < 468 464 treat_as_floating_point<rep>, 469 465 mpl::and_ < 470 mpl::bool_ < ratio_divide<Period2, period>::type::den == 1>,466 chrono_detail::is_evenly_divisible_by<Period2, period>, 471 467 mpl::not_ < treat_as_floating_point<Rep2> > 472 468 > 473 469 > 474 470 >::type* = 0 475 #endif 476 ) 471 ) 477 472 : rep_(chrono::detail::duration_cast<duration<Rep2, Period2>, duration>()(d).count()) {} 478 473 479 474 // observer … … 560 555 561 556 template <class Rep1, class Period, class Rep2> 562 557 inline 563 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)564 duration<typename common_type<Rep1, Rep2>::type, Period>565 #else566 558 typename boost::enable_if < 567 559 mpl::and_ < 568 560 boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>, … … 570 562 >, 571 563 duration<typename common_type<Rep1, Rep2>::type, Period> 572 564 >::type 573 #endif574 565 operator*(const duration<Rep1, Period>& d, const Rep2& s) 575 566 { 576 567 typedef typename common_type<Rep1, Rep2>::type CR; … … 581 572 582 573 template <class Rep1, class Period, class Rep2> 583 574 inline 584 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)585 duration<typename common_type<Rep1, Rep2>::type, Period>586 #else587 575 typename boost::enable_if < 588 576 mpl::and_ < 589 577 boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>, … … 591 579 >, 592 580 duration<typename common_type<Rep1, Rep2>::type, Period> 593 581 >::type 594 #endif595 582 operator*(const Rep1& s, const duration<Rep2, Period>& d) 596 583 { 597 584 return d * s; … … 676 663 bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) 677 664 { 678 665 typedef typename common_type<LhsDuration, RhsDuration>::type CD; 679 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)680 // trying to simplify expression so enable_if is not used (Pb. with MSVC.9.0)681 return682 chrono::detail::duration_cast<LhsDuration, CD>()(lhs).count()683 ==684 chrono::detail::duration_cast<RhsDuration, CD>()(rhs).count();685 #else686 666 return CD(lhs).count() == CD(rhs).count(); 687 #endif688 667 } 689 668 }; 690 669 … … 703 682 bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) 704 683 { 705 684 typedef typename common_type<LhsDuration, RhsDuration>::type CD; 706 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)707 // trying to simplify expression so enable_if is not used (Pb. with MSVC.9.0)708 return709 chrono::detail::duration_cast<LhsDuration, CD>()(lhs).count()710 <711 chrono::detail::duration_cast<RhsDuration, CD>()(rhs).count();712 #else713 685 return CD(lhs).count() < CD(rhs).count(); 714 #endif715 686 } 716 687 }; 717 688 … … 801 772 // Compile-time select the most efficient algorithm for the conversion... 802 773 template <class ToDuration, class Rep, class Period> 803 774 inline BOOST_CHRONO_CONSTEXPR 804 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)805 ToDuration806 #else807 775 typename boost::enable_if < 808 776 boost::chrono::detail::is_duration<ToDuration>, ToDuration>::type 809 #endif810 777 duration_cast(const duration<Rep, Period>& fd) 811 778 { 812 779 return boost::chrono::detail::duration_cast< -
time_point.hpp
170 170 template <class Duration2> 171 171 BOOST_CHRONO_CONSTEXPR 172 172 time_point(const time_point<clock, Duration2>& t 173 #if defined(BOOST_MSVC) && (BOOST_MSVC == 1500)174 #else175 173 , typename boost::enable_if 176 174 < 177 175 boost::is_convertible<Duration2, duration> 178 176 >::type* = 0 179 #endif180 177 ) 181 178 : d_(t.time_since_epoch()) 182 179 {