Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84257 - in sandbox/chrono_date: boost/chrono/date libs/date/src
From: vicente.botet_at_[hidden]
Date: 2013-05-12 17:16:18


Author: viboes
Date: 2013-05-12 17:16:17 EDT (Sun, 12 May 2013)
New Revision: 84257
URL: http://svn.boost.org/trac/boost/changeset/84257

Log:
Chrono/Date: Added more factories and year_month year and month arithmetic.
Text files modified:
   sandbox/chrono_date/boost/chrono/date/tuples.hpp | 183 +++++++++++++++++++++++++++++----------
   sandbox/chrono_date/boost/chrono/date/ymd_date.hpp | 20 ++++
   sandbox/chrono_date/libs/date/src/vars.cpp | 35 +++++++
   sandbox/chrono_date/libs/date/src/ymd_date.cpp | 1
   4 files changed, 189 insertions(+), 50 deletions(-)

Modified: sandbox/chrono_date/boost/chrono/date/tuples.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/tuples.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/tuples.hpp 2013-05-12 17:16:17 EDT (Sun, 12 May 2013)
@@ -37,12 +37,12 @@
       year y_;
       month m_;
     public:
- BOOST_CONSTEXPR year_month(year y, month m) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month(year y, month m) BOOST_NOEXCEPT
       : y_(y),
       m_(m)
       {
       }
- year_month(year::rep y, month::rep m, check_t) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month(year::rep y, month::rep m, check_t) BOOST_NOEXCEPT
       : y_(y, check),
       m_(m, check)
       {
@@ -51,7 +51,7 @@
        * @Return the year stored component.
        */
       //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
@@ -60,29 +60,116 @@
        * @Return the month stored component.
        */
       //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
 
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
+ {
+ return y_.is_leap();
+ }
+
       // @todo make it possible to have BOOST_CONSTEXPR days_in
       /**
        * @Return the number of days of this month in this year.
        */
- chrono::days days_in() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::days days_in() const BOOST_NOEXCEPT
       {
         return y_.days_in_month(m_);
       }
+
+ year_month& operator+=(months m) BOOST_NOEXCEPT;
+ BOOST_FORCEINLINE year_month& operator++() BOOST_NOEXCEPT
+ {
+ return *this += months(1);
+ }
+ BOOST_FORCEINLINE year_month operator++(int) BOOST_NOEXCEPT
+ {
+ year_month tmp(*this);
+ ++(*this);
+ return tmp;
+ }
+ BOOST_FORCEINLINE year_month& operator-=(months m) BOOST_NOEXCEPT
+ {
+ return *this += -m;
+ }
+ BOOST_FORCEINLINE year_month& operator--() BOOST_NOEXCEPT
+ {
+ return *this -= months(1);
+ }
+ BOOST_FORCEINLINE year_month operator--(int) BOOST_NOEXCEPT
+ {
+ year_month tmp(*this); --(*this); return tmp;
+ }
+
+ friend BOOST_FORCEINLINE year_month operator+(year_month ym, months m) BOOST_NOEXCEPT
+ {
+ ym += m;
+ return ym;
+ }
+ friend BOOST_FORCEINLINE year_month operator+(months m, year_month ym) BOOST_NOEXCEPT
+ {
+ ym += m;
+ return ym;
+ }
+ friend BOOST_FORCEINLINE year_month operator-(year_month ym, months m) BOOST_NOEXCEPT
+ {
+ ym -= m;
+ return ym;
+ }
+ friend BOOST_FORCEINLINE months operator-(year_month x, year_month y) BOOST_NOEXCEPT;
+
+ BOOST_FORCEINLINE year_month& operator+=(years y) BOOST_NOEXCEPT
+ {
+ y_ = chrono::year(y_ + y.count());
+ return *this;
+ }
+ BOOST_FORCEINLINE year_month& operator-=(years y) BOOST_NOEXCEPT
+ {
+ return *this += years(-y.count());
+ }
+
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator+(year_month ym, years y) BOOST_NOEXCEPT
+ {
+ return year_month(year(ym+y), month(ym));
+ }
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator+(years y, year_month ym) BOOST_NOEXCEPT
+ {
+ return year_month(year(ym+y), month(ym));
+ }
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator-(year_month ym, years y) BOOST_NOEXCEPT
+ {
+ return year_month(year(ym-y), month(ym));
+ }
+
     };
 
- inline BOOST_CONSTEXPR year_month operator/(year y, month m) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator/(year y, month m) BOOST_NOEXCEPT
     {
       return year_month(y, m);
     }
- inline BOOST_CONSTEXPR year_month operator/(month m, year y) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator/(month m, year y) BOOST_NOEXCEPT
     {
       return year_month(y, m);
     }
+// BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator/(chrono::year y, int m) BOOST_NOEXCEPT
+// {
+// return year_month(y, chrono::month(m));
+// }
+// BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator/(int m, chrono::year y) BOOST_NOEXCEPT
+// {
+// return year_month(y, chrono::month(m));
+// }
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator/(int y, chrono::month m) BOOST_NOEXCEPT
+ {
+ return year_month(chrono::year(y), m);
+ }
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month operator/(chrono::month m, int y) BOOST_NOEXCEPT
+ {
+ return year_month(chrono::year(y), m);
+ }
+
 
     /**
      * Class year_week is a tuple-like class of year-week.
@@ -94,12 +181,12 @@
       year y_;
       week w_;
     public:
- BOOST_CONSTEXPR year_week(year y, week w) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_week(year y, week w) BOOST_NOEXCEPT
       : y_(y),
       w_(w)
       {
       }
- year_week(year y, week w, check_t) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_week(year y, week w, check_t) BOOST_NOEXCEPT
       : y_(y, check),
       w_(w, check)
       {
@@ -109,7 +196,7 @@
        * @Return the year stored component.
        */
       //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
@@ -117,19 +204,19 @@
        * @Return the week stored component.
        */
       //BOOST_CONSTEXPR chrono::week week() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
       {
         return w_;
       }
 
     };
 
- inline BOOST_CONSTEXPR year_week operator/(year y, week w) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_week operator/(year y, week w) BOOST_NOEXCEPT
     {
       return year_week(y, w);
     }
 
- inline BOOST_CONSTEXPR year_week operator/(week w, year y) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_week operator/(week w, year y) BOOST_NOEXCEPT
     {
       return year_week(y, w);
     }
@@ -147,13 +234,13 @@
       month m_;
       day d_;
     public:
- BOOST_CONSTEXPR month_day(month m, day d)BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR month_day(month m, day d)BOOST_NOEXCEPT
       : m_(m),
       d_(d)
       {
         // check validity of day relative to month.
       }
- month_day(month::rep m, day::rep d, check_t)BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR month_day(month::rep m, day::rep d, check_t)BOOST_NOEXCEPT
       : m_(m,check),
       d_(d,check)
       {
@@ -162,7 +249,7 @@
        * @Return the month stored component.
        */
       //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
@@ -170,19 +257,19 @@
        * @Return the day stored component.
        */
       //BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
       {
         return d_;
       }
     };
 
- inline BOOST_CONSTEXPR month_day operator/(month m, day d) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR month_day operator/(month m, day d) BOOST_NOEXCEPT
     {
       return month_day(m, d);
     }
 
 
- inline BOOST_CONSTEXPR month_day operator/(day d, month m) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR month_day operator/(day d, month m) BOOST_NOEXCEPT
     {
       return month_day(m, d);
     }
@@ -254,36 +341,36 @@
       week w_;
       weekday wd_;
     public:
- BOOST_CONSTEXPR week_weekday(week w, weekday wd)BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR week_weekday(week w, weekday wd)BOOST_NOEXCEPT
       : w_(w),
       wd_(wd)
       {
       }
 
- week_weekday(week::rep w, weekday::rep wd, check_t)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR week_weekday(week::rep w, weekday::rep wd, check_t)
       : w_(w, check),
       wd_(wd, check)
       {
       }
       //BOOST_CONSTEXPR chrono::week week() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
       {
         return w_;
       }
       //BOOST_CONSTEXPR chrono::weekday weekday() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
       {
         return wd_;
       }
 
     };
 
- inline BOOST_CONSTEXPR week_weekday operator/(week w, weekday wd) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR week_weekday operator/(week w, weekday wd) BOOST_NOEXCEPT
     {
       return week_weekday(w, wd);
     }
 
- inline BOOST_CONSTEXPR week_weekday operator/(weekday wd, week w) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR week_weekday operator/(weekday wd, week w) BOOST_NOEXCEPT
     {
       return week_weekday(w, wd);
     }
@@ -300,35 +387,35 @@
       month m_;
       day d_;
     public:
- BOOST_CONSTEXPR year_month_day(year y, month m, day d)BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month_day(year y, month m, day d)BOOST_NOEXCEPT
       : y_(y),
       m_(m),
       d_(d)
       {
       }
 
- year_month_day(year::rep y, month::rep m, day::rep d, check_t)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month_day(year::rep y, month::rep m, day::rep d, check_t)
       : y_(y, check),
       m_(m, check),
       d_(d, check)
       {
       }
       //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
       //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
       //BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
       {
         return d_;
       }
- BOOST_CONSTEXPR bool is_valid()
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid()
       {
         // @todo implement this function
         return true;
@@ -348,7 +435,7 @@
       day d_;
       bool leap_;
     public:
- BOOST_CONSTEXPR year_month_day_leap(year y, month m, day d, bool leap)BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month_day_leap(year y, month m, day d, bool leap)BOOST_NOEXCEPT
       : y_(y),
       m_(m),
       d_(d),
@@ -357,7 +444,7 @@
       }
 
       // @todo remove this overload
- BOOST_CONSTEXPR year_month_day_leap(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_month_day_leap(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
       : y_(y),
       m_(m),
       d_(d),
@@ -365,21 +452,21 @@
       {
       }
       //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
       //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
       //BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
       {
         return d_;
       }
- BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
       {
         return leap_;
       }
@@ -400,27 +487,27 @@
       year y_;
       day_of_year d_;
     public:
- BOOST_CONSTEXPR year_day_of_year(year y, day_of_year d)BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_day_of_year(year y, day_of_year d)BOOST_NOEXCEPT
       : y_(y),
       d_(d)
       {
       }
- year_day_of_year(year::rep y, day_of_year::rep d, check_t)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_day_of_year(year::rep y, day_of_year::rep d, check_t)
       : y_(y, check),
       d_(d, check)
       {
       }
       //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
       //BOOST_CONSTEXPR chrono::day_of_year day_of_year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day_of_year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::day_of_year() const BOOST_NOEXCEPT
       {
         return d_;
       }
- BOOST_CONSTEXPR bool is_valid()
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid()
       {
         // @todo implement this function
         return true;
@@ -441,35 +528,35 @@
       week w_;
       weekday wd_;
     public:
- BOOST_CONSTEXPR year_week_weekday(year y, week w, weekday wd)BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_week_weekday(year y, week w, weekday wd)BOOST_NOEXCEPT
       : y_(y),
       w_(w),
       wd_(wd)
       {
       }
 
- year_week_weekday(year::rep y, week::rep w, weekday::rep wd, check_t)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR year_week_weekday(year::rep y, week::rep w, weekday::rep wd, check_t)
       : y_(y, check),
       w_(w, check),
       wd_(wd, check)
       {
       }
       //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
       //BOOST_CONSTEXPR chrono::week week() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
       {
         return w_;
       }
       //BOOST_CONSTEXPR chrono::weekday weekday() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
       {
         return wd_;
       }
- BOOST_CONSTEXPR bool is_valid()
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid()
       {
         // @todo implement this function
         return true;

Modified: sandbox/chrono_date/boost/chrono/date/ymd_date.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/ymd_date.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/ymd_date.hpp 2013-05-12 17:16:17 EDT (Sun, 12 May 2013)
@@ -780,7 +780,7 @@
        * @Returns: *this += -y.
        *
        */
- ymd_date& operator-=(years y)
+ BOOST_FORCEINLINE ymd_date& operator-=(years y)
       {
         return *this += years(-y.count());
       }
@@ -950,6 +950,24 @@
       return ymd_date(year(y), m, d);
     }
 
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(year_month ym, day d)
+ {
+ return ymd_date(year(ym), month(ym), d);
+ }
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(year_month ym, int d)
+ {
+ return ymd_date(year(ym), month(ym), day(d));
+ }
+
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(year y, month_day md)
+ {
+ return ymd_date(y, md);
+ }
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(int y, month_day md)
+ {
+ return ymd_date(year(y), md);
+ }
+
   } // chrono
 
 } // boost

Modified: sandbox/chrono_date/libs/date/src/vars.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/vars.cpp (original)
+++ sandbox/chrono_date/libs/date/src/vars.cpp 2013-05-12 17:16:17 EDT (Sun, 12 May 2013)
@@ -194,6 +194,41 @@
     {
       return month_day_to_day_of_year_[b][m-1][d-1];
     }
+
+ // year_month
+
+ year_month&
+ year_month::operator+=(months mn) BOOST_NOEXCEPT
+ {
+ year::rep y = y_;
+ month::rep m = m_;
+ m += mn.count();
+ if (m < 1)
+ {
+ int dy = (12 - m) / 12;
+ y -= dy;
+ m += 12 * dy;
+ }
+ else if (m > 12)
+ {
+ int dy = (m - 1) / 12;
+ y += dy;
+ m -= 12 * dy;
+ }
+ y_ = chrono::year(y);
+ m_ = chrono::month(m);
+ return *this;
+ }
+
+ months operator-(year_month x, year_month y) BOOST_NOEXCEPT
+ {
+ year::rep y1 = x.y_;
+ month::rep m1 = x.m_;
+ year::rep y2 = y.y_;
+ month::rep m2 = y.m_;
+ return months(y1 * 12 + m1 - (y2 * 12 + m2));
+ }
+
 } // boost
   } // chrono
 

Modified: sandbox/chrono_date/libs/date/src/ymd_date.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/ymd_date.cpp (original)
+++ sandbox/chrono_date/libs/date/src/ymd_date.cpp 2013-05-12 17:16:17 EDT (Sun, 12 May 2013)
@@ -166,7 +166,6 @@
     ymd_date::ymd_date(days d)
     {
 #if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
-//#if ! defined __clang__
 #if 0
       year_month_day_leap ymdl = to_ymd_leap(d);
       leap_=ymdl.is_leap_year();


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