Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70074 - trunk/boost/chrono
From: vicente.botet_at_[hidden]
Date: 2011-03-17 15:19:33


Author: viboes
Date: 2011-03-17 15:19:31 EDT (Thu, 17 Mar 2011)
New Revision: 70074
URL: http://svn.boost.org/trac/boost/changeset/70074

Log:
Chrono: #5322, #5323, time_point operators ++,--
Text files modified:
   trunk/boost/chrono/duration.hpp | 5 ++---
   trunk/boost/chrono/time_point.hpp | 17 +++++++++++++++++
   2 files changed, 19 insertions(+), 3 deletions(-)

Modified: trunk/boost/chrono/duration.hpp
==============================================================================
--- trunk/boost/chrono/duration.hpp (original)
+++ trunk/boost/chrono/duration.hpp 2011-03-17 15:19:31 EDT (Thu, 17 Mar 2011)
@@ -430,7 +430,7 @@
     public:
 
         BOOST_CHRONO_CONSTEXPR
- duration() { }
+ duration() : rep_(duration_values<rep>::zero()) { }
         template <class Rep2>
         BOOST_CHRONO_CONSTEXPR
         explicit duration(const Rep2& r
@@ -446,8 +446,7 @@
>
>
>::type* = 0
- )
- : rep_(r) { }
+ ) : rep_(r) { }
         ~duration() {} //= default;
         duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
         duration& operator=(const duration& rhs) // = default;

Modified: trunk/boost/chrono/time_point.hpp
==============================================================================
--- trunk/boost/chrono/time_point.hpp (original)
+++ trunk/boost/chrono/time_point.hpp 2011-03-17 15:19:31 EDT (Thu, 17 Mar 2011)
@@ -155,6 +155,8 @@
         typedef Duration duration;
         typedef typename duration::rep rep;
         typedef typename duration::period period;
+ typedef Duration difference_type;
+
     private:
         duration d_;
 
@@ -188,6 +190,21 @@
 
         // arithmetic
 
+#ifdef BOOST_CHRONO_EXTENSIONS
+ BOOST_CHRONO_CONSTEXPR
+ time_point operator+() const {return *this;}
+ BOOST_CHRONO_CONSTEXPR
+ time_point operator-() const {return time_point(-d_);}
+ time_point& operator++() {++d_; return *this;}
+ time_point operator++(int) {return time_point(d_++);}
+ time_point& operator--() {--d_; return *this;}
+ time_point operator--(int) {return time_point(d_--);}
+
+ time_point& operator+=(const rep& r) {d_ += r; return *this;}
+ time_point& operator-=(const rep& r) {d_ -= r; return *this;}
+
+#endif
+
         time_point& operator+=(const duration& d) {d_ += d; return *this;}
         time_point& operator-=(const duration& d) {d_ -= d; return *this;}
 


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