Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84234 - in sandbox/chrono_date: boost/chrono/date boost/chrono/date/detail libs/date libs/date/build libs/date/doc libs/date/example libs/date/perf libs/date/src libs/date/test libs/date/test/dates/days libs/date/test/dates/ydoy libs/date/test/dates/ymd libs/date/test/durations/eras libs/date/test/wrappers
From: vicente.botet_at_[hidden]
Date: 2013-05-11 11:54:26


Author: viboes
Date: 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
New Revision: 84234
URL: http://svn.boost.org/trac/boost/changeset/84234

Log:
Chrono/Date: major refactoring taking in account some of the recent discussions.
Added:
   sandbox/chrono_date/libs/date/index.html (contents, props changed)
   sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp (contents, props changed)
   sandbox/chrono_date/libs/date/test/durations/eras/
Text files modified:
   sandbox/chrono_date/boost/chrono/date/config.hpp | 31 +
   sandbox/chrono_date/boost/chrono/date/conversions.hpp | 10
   sandbox/chrono_date/boost/chrono/date/date.hpp | 8
   sandbox/chrono_date/boost/chrono/date/date_generators.hpp | 89 ++-
   sandbox/chrono_date/boost/chrono/date/date_io.hpp | 15
   sandbox/chrono_date/boost/chrono/date/day.hpp | 3
   sandbox/chrono_date/boost/chrono/date/day_of_year.hpp | 9
   sandbox/chrono_date/boost/chrono/date/days_date.hpp | 526 +++++++++++++----------
   sandbox/chrono_date/boost/chrono/date/detail/bounded.hpp | 6
   sandbox/chrono_date/boost/chrono/date/detail/helpers.hpp | 31 +
   sandbox/chrono_date/boost/chrono/date/include.hpp | 10
   sandbox/chrono_date/boost/chrono/date/month.hpp | 44 -
   sandbox/chrono_date/boost/chrono/date/month_nth.hpp | 69 --
   sandbox/chrono_date/boost/chrono/date/month_nth_weekday.hpp | 38
   sandbox/chrono_date/boost/chrono/date/no_check.hpp | 1
   sandbox/chrono_date/boost/chrono/date/nth.hpp | 37
   sandbox/chrono_date/boost/chrono/date/nth_week.hpp | 4
   sandbox/chrono_date/boost/chrono/date/nth_weekday.hpp | 36 -
   sandbox/chrono_date/boost/chrono/date/relative_date.hpp | 129 ++---
   sandbox/chrono_date/boost/chrono/date/tuples.hpp | 148 ++++--
   sandbox/chrono_date/boost/chrono/date/week.hpp | 2
   sandbox/chrono_date/boost/chrono/date/weekday.hpp | 34
   sandbox/chrono_date/boost/chrono/date/ydoy_date.hpp | 730 +++++++++++++++++++-------------
   sandbox/chrono_date/boost/chrono/date/year.hpp | 43 +
   sandbox/chrono_date/boost/chrono/date/ymd_date.hpp | 714 ++++++++++++++++++++-----------
   sandbox/chrono_date/libs/date/build/Jamfile.v2 | 18
   sandbox/chrono_date/libs/date/doc/Jamfile.v2 | 23
   sandbox/chrono_date/libs/date/example/ex_week_based_year.cpp | 8
   sandbox/chrono_date/libs/date/example/hello_world.cpp | 61 +-
   sandbox/chrono_date/libs/date/example/julian.cpp | 6
   sandbox/chrono_date/libs/date/example/julian.hpp | 23
   sandbox/chrono_date/libs/date/example/week_based_year.hpp | 25
   sandbox/chrono_date/libs/date/src/conversions.cpp | 117 ++++
   sandbox/chrono_date/libs/date/src/date.cpp | 20
   sandbox/chrono_date/libs/date/src/days_date.cpp | 327 +++++++-------
   sandbox/chrono_date/libs/date/src/rel_date.cpp | 255 ++++++-----
   sandbox/chrono_date/libs/date/src/vars.cpp | 72 +-
   sandbox/chrono_date/libs/date/src/ydoy_date.cpp | 390 ++++++++---------
   sandbox/chrono_date/libs/date/src/ymd_date.cpp | 365 +++++++---------
   sandbox/chrono_date/libs/date/test/Jamfile.v2 | 25 +
   sandbox/chrono_date/libs/date/test/dates/days/days_date_pass.cpp | 675 ++++++++++++++++-------------
   sandbox/chrono_date/libs/date/test/dates/days/nth_days_date_pass.cpp | 238 +++++-----
   sandbox/chrono_date/libs/date/test/dates/ydoy/ydoy_date_pass.cpp | 884 ++++++++++++++++++++-------------------
   sandbox/chrono_date/libs/date/test/dates/ymd/ymd_date_pass.cpp | 566 ++++++++++++------------
   sandbox/chrono_date/libs/date/test/wrappers/day_pass.cpp | 1
   45 files changed, 3708 insertions(+), 3158 deletions(-)

Modified: sandbox/chrono_date/boost/chrono/date/config.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/config.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/config.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -10,19 +10,12 @@
 
 #include <boost/chrono/config.hpp>
 
-
 // 1 => days + ymd + leap
 // 2 => days
 // 3 => ymd + leap
 // 4 => ydoy + leap
 #ifndef BOOST_CHRONO_DATE_DATE_DESIGN
-#define BOOST_CHRONO_DATE_DATE_DESIGN 2
-#endif
-
-// 1 => days +ymd +leap
-// 3 => ymd +leap
-#ifndef BOOST_CHRONO_DATE_YMD_DATE_DESIGN
-#define BOOST_CHRONO_DATE_YMD_DATE_DESIGN 3
+#define BOOST_CHRONO_DATE_DATE_DESIGN 3
 #endif
 
 // 1 => days +ymd +leap
@@ -35,5 +28,27 @@
 
 //#define BOOST_CHRONO_DATE_DATE_DESIGN_BUG
 
+#if ! defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) || defined BOOST_CHRONO_DATE_DOXYGEN_INVOKED
+#define BOOST_CHRONO_EXPLICT explicit
+#else
+#define BOOST_CHRONO_EXPLICT
+#endif
+
+#if ! defined BOOST_NO_CXX11_CONSTEXPR && defined __clang__
+#define BOOST_CHRONO_DATE_CONSTEXPR BOOST_CONSTEXPR
+#else
+#define BOOST_CHRONO_DATE_CONSTEXPR
+#endif
+
+
+#ifndef BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(T, N, V) constexpr T N(V)
+#define BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(T, N, V)
+
+#else
+#define BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(T, N, V) extern const T N
+#define BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(T, N, V) const T N(V);
+#endif
+
 
 #endif // header

Modified: sandbox/chrono_date/boost/chrono/date/conversions.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/conversions.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/conversions.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -20,6 +20,8 @@
   namespace chrono
   {
 
+
+
     /**
      * days to ymd conversion.
      * @param d the days to convert.
@@ -35,6 +37,14 @@
     year_day_of_year to_ydoy(year_month_day) BOOST_NOEXCEPT;
     year_day_of_year to_ydoy(year_week_weekday) BOOST_NOEXCEPT;
 
+ days::rep to_days(int y, int m, int d) BOOST_NOEXCEPT;
+ days::rep to_days(int_least32_t y, int_least16_t m, int_least16_t d) BOOST_NOEXCEPT;
+ days::rep to_days(int_least32_t y, int_least16_t m, int_least16_t d, bool) BOOST_NOEXCEPT;
+ void to_ymd(days::rep dt, int& y, int& m, int& d) BOOST_NOEXCEPT;
+ void to_ymd(days::rep dt, int_least32_t& y, int_least16_t& m, int_least16_t& d) BOOST_NOEXCEPT;
+ void to_ymdl(days::rep dt, int_least32_t& y, int_least16_t& m, int_least16_t& d, bool& leap) BOOST_NOEXCEPT;
+ //int_least16_t to_ymdl(days::rep dt, int_least32_t y, int_least16_t& m, int_least16_t& d, bool& leap) BOOST_NOEXCEPT;
+
     days to_days(year_month_day) BOOST_NOEXCEPT;
     days to_days(year_day_of_year) BOOST_NOEXCEPT;
     days to_days(year_week_weekday) BOOST_NOEXCEPT;

Modified: sandbox/chrono_date/boost/chrono/date/date.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/date.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/date.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -9,18 +9,10 @@
 #ifndef BOOST_CHRONO_DATE_TMP_DATE_HPP
 #define BOOST_CHRONO_DATE_TMP_DATE_HPP
 
-
 #include <boost/chrono/date/config.hpp>
 #include <boost/chrono/date/ymd_date.hpp>
-#if BOOST_CHRONO_DATE_DATE_DESIGN == 1 | BOOST_CHRONO_DATE_DATE_DESIGN == 3
-#elif BOOST_CHRONO_DATE_DATE_DESIGN == 2
 #include <boost/chrono/date/days_date.hpp>
-#if defined BOOST_CHRONO_DATE_DATE_DESIGN_BUG
-#include <boost/chrono/date/tmp/date.hpp>
-#endif
-#elif BOOST_CHRONO_DATE_DATE_DESIGN == 4
 #include <boost/chrono/date/ydoy_date.hpp>
-#endif
 
 namespace boost
 {

Modified: sandbox/chrono_date/boost/chrono/date/date_generators.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/date_generators.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/date_generators.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -32,15 +32,15 @@
      * @tparam Date any model of a Date (is_date<Date> is true_type).
      * @param wd the constraint applied to the date @c x parameter.
      * @param x the reference date.
- * @return Let @c a be @c wd converted to an @c int, and @c b be @c x.weekday()
+ * @return Let @c a be @c wd converted to an @c int, and @c b be @c weekday(x)
      * converted to an @c int. If <c>a < b</c>, returns <c>x - days(b-a)</c>, else returns <c>x - days(7 - (a-b))</c>.
      */
- template <typename Date>
- inline Date
- operator<(weekday wd, Date x)
+ //template <typename Date>
+ inline days_date
+ operator<(weekday wd, days_date x)
     {
- const week::rep a = static_cast<week::rep>(wd);
- const week::rep b = static_cast<week::rep>(x.get_weekday());
+ const weekday::rep a = wd;
+ const weekday::rep b = weekday(x);
       if (a < b)
       {
         return x - days(b-a);
@@ -48,12 +48,12 @@
       return x - days(weekday::size - (a-b));
     }
 
- template <typename Date>
- inline Date
- operator<=(weekday wd, Date x)
+ //template <typename Date>
+ inline days_date
+ operator<=(weekday wd, days_date x)
     {
- const week::rep a = static_cast<week::rep>(wd);
- const week::rep b = static_cast<week::rep>(x.get_weekday());
+ const weekday::rep a = wd;
+ const weekday::rep b = weekday(x);
       if (a <= b)
       {
         return x - days(b-a);
@@ -61,12 +61,13 @@
       return x - days(weekday::size - (a-b));
     }
 
- template <typename Date>
- inline Date
- operator>(weekday wd, Date x)
+ //template <typename Date>
+ inline days_date
+ operator>(weekday wd, days_date x)
     {
- const week::rep a = static_cast<week::rep>(x.get_weekday());
- const week::rep b = static_cast<week::rep>(wd);
+ const weekday::rep b = wd;
+ const weekday::rep a = weekday(x);
+
       if (a < b)
       {
         return x + days(b-a);
@@ -74,12 +75,12 @@
       return x + days(weekday::size - (a-b));
     }
 
- template <typename Date>
- inline Date
- operator>=(weekday wd, Date x)
+ //template <typename Date>
+ inline days_date
+ operator>=(weekday wd, days_date x)
     {
- const week::rep a = static_cast<week::rep>(x.get_weekday());
- const week::rep b = static_cast<week::rep>(wd);
+ const weekday::rep b = wd;
+ const weekday::rep a = weekday(x);
       if (a <= b)
       {
         return x + days(b-a);
@@ -92,9 +93,9 @@
     operator >(month_day md, Date d)
     {
       Date res;
- if (res.set_if_valid_date(d.get_year(),md.get_month(),md.get_day()) && res > d ) return res;
- if (res.set_if_valid_date(year(d.get_year()+1),md.get_month(),md.get_day()) && res > d ) return res;
- res=Date(year(d.get_year()+2),md.get_month(),md.get_day());
+ if (res.set_if_valid_date(year(d),month(md),day(md)) && res > d ) return res;
+ if (res.set_if_valid_date(year(year(d)+1),month(md),day(md)) && res > d ) return res;
+ res=Date(year(year(d)+2),month(md),day(md));
       return res;
     }
     template <typename Date>
@@ -102,9 +103,9 @@
     operator >=(month_day md, Date d)
     {
       Date res;
- if (res.set_if_valid_date(d.get_year(),md.get_month(),md.get_day()) && res >= d) return res;
- if (res.set_if_valid_date(year(d.get_year()+1),md.get_month(),md.get_day()) && res >= d) return res;
- res=Date(year(d.get_year()+2),md.get_month(),md.get_day());
+ if (res.set_if_valid_date(year(d),month(md),day(md)) && res >= d) return res;
+ if (res.set_if_valid_date(year(year(d)+1),month(md),day(md)) && res >= d) return res;
+ res=Date(year(year(d)+2),month(md),day(md));
       return res;
     }
 
@@ -114,50 +115,50 @@
     {
       std::cout << __FILE__<<"["<<__LINE__ <<"] "<< d << '\n';
       Date res;
- if (d.get_month()==dec)
+ if (month(d)==dec)
       { // dec and jan have 31 days
- res = Date(d.get_year(),d.get_month(),n.value());
+ res = Date(year(d),month(d),n.value());
         std::cout << __FILE__<<"["<<__LINE__ <<"] "<< res << '\n';
 
         if (res > d) return res;
- return Date(d.get_year(),jan,n.value());
+ return Date(year(d),jan,n.value());
       }
 
       if (n.value()>28)
       { // As feb could have 29,30 and 31, we need to validate the two first dates
- if (res.set_if_valid_date(d.get_year(),d.get_month(),day(n.value())) && res > d) return res;
- if (res.set_if_valid_date(d.get_year(),month(d.get_month()+1),day(n.value())) && res > d) return res;
- return Date(d.get_year(),month(d.get_month()+2),day(n.value())) ;
+ if (res.set_if_valid_date(year(d),month(d),day(n.value())) && res > d) return res;
+ if (res.set_if_valid_date(year(d),month(month(d)+1),day(n.value())) && res > d) return res;
+ return Date(year(d),month(month(d)+2),day(n.value())) ;
       }
       // nth <= 28 is always valid, so the next is either in this month or the next one
- res = Date(d.get_year(),d.get_month(),n.value());
+ res = Date(year(d),month(d),n.value());
       std::cout << __FILE__<<"["<<__LINE__ <<"] "<< res << '\n';
       if (res > d) return res;
- std::cout << __FILE__<<"["<<__LINE__ <<"] "<< int(d.get_month()+1) << '\n';
- return Date(d.get_year(),month(d.get_month()+1),day(n.value()));
+ std::cout << __FILE__<<"["<<__LINE__ <<"] "<< int(month(d)+1) << '\n';
+ return Date(year(d),month(month(d)+1),day(n.value()));
     }
     template <typename Date>
     inline Date
     operator >=(nth n, Date d)
     {
       Date res;
- if (d.get_month()==dec)
+ if (month(d)==dec)
       { // dec and jan have 31 days
- res = Date(d.get_year(),d.get_month(),n.value());
+ res = Date(year(d),month(d),n.value());
         if (res >= d) return res;
- return Date(d.get_year(),jan,n.value());
+ return Date(year(d),jan,n.value());
       }
 
       if (n.value()>28)
       { // As feb could have 29,30 and 31, we need to validate the two first dates
- if (res.set_if_valid_date(d.get_year(),d.get_month(),day(n.value())) && res >= d) return res;
- if (res.set_if_valid_date(d.get_year(),month(d.get_month()+1),day(n.value())) && res >= d) return res;
- return Date(d.get_year(),d.get_month()+2,n.value()) ;
+ if (res.set_if_valid_date(year(d),month(d),day(n.value())) && res >= d) return res;
+ if (res.set_if_valid_date(year(d),month(month(d)+1),day(n.value())) && res >= d) return res;
+ return Date(year(d),month(d)+2,n.value()) ;
       }
       // nth <= 28 is always valid, so the next is either in this month or the next one
- res = Date(d.get_year(),d.get_month(),n.value());
+ res = Date(year(d),month(d),n.value());
       if (res >= d) return res;
- return Date(d.get_year(),month(d.get_month()+1),n.value());
+ return Date(year(d),month(month(d)+1),n.value());
     }
 
 

Modified: sandbox/chrono_date/boost/chrono/date/date_io.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/date_io.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/date_io.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -68,6 +68,7 @@
 #include <boost/chrono/date/year.hpp>
 #include <boost/chrono/date/month.hpp>
 #include <boost/chrono/date/day.hpp>
+#include <boost/chrono/date/days_date.hpp>
 #include <boost/chrono/date/is_date.hpp>
 #include <boost/utility/enable_if.hpp>
 
@@ -247,7 +248,7 @@
         charT, traits>& is, Date& item)
     {
       typename std::basic_istream<charT, traits>::sentry ok(is);
- if (ok)
+ if (bool(ok))
       {
         std::ios_base::iostate err = std::ios_base::goodbit;
 #ifndef BOOST_NO_EXCEPTIONS
@@ -273,7 +274,7 @@
           if (!(err & std::ios_base::failbit))
           {
             item
- = Date(year(t.tm_year + 1900), month(t.tm_mon + 1), day(t.tm_mday));
+ = Date(year(t.tm_year + 1900), chrono::month(t.tm_mon + 1), day(t.tm_mday));
           }
         }
 #ifndef BOOST_NO_EXCEPTIONS
@@ -316,7 +317,7 @@
         charT, traits>& os, const Date& item)
     {
       typename std::basic_ostream<charT, traits>::sentry ok(os);
- if (ok)
+ if (bool(ok))
       {
         bool failed;
 #ifndef BOOST_NO_EXCEPTIONS
@@ -326,10 +327,10 @@
           const std::time_put<charT>& tp =
               std::use_facet<std::time_put<charT> >(os.getloc());
           std::tm t;
- t.tm_mday = item.get_day();
- t.tm_mon = item.get_month() - 1;
- t.tm_year = item.get_year() - 1900;
- t.tm_wday = item.get_weekday();
+ t.tm_mday = item.to_day();
+ t.tm_mon = item.to_month() - 1;
+ t.tm_year = item.to_year() - 1900;
+ t.tm_wday = days_date(item).to_weekday();
           charT pattern[] =
           { '%', 'F' };
           const charT* pb = pattern;

Modified: sandbox/chrono_date/boost/chrono/date/day.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/day.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/day.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -11,6 +11,7 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/chrono/date/detail/bounded.hpp>
+#include <boost/chrono/date/detail/helpers.hpp>
 
 namespace boost
 {
@@ -23,7 +24,7 @@
     /**
      * The class @c day is used to specify the day of the month when constructing dates. Its range is [1,31].
      */
- typedef bounded<day_tag, 1, 31, int_least8_t> day;
+ typedef bounded<day_tag, 1, 31, day_rep> day;
 
     /**
      * synonym of day.

Modified: sandbox/chrono_date/boost/chrono/date/day_of_year.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/day_of_year.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/day_of_year.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -8,9 +8,9 @@
 #ifndef BOOST_CHRONO_DATE_DATE_DAY_OF_YEAR_HPP
 #define BOOST_CHRONO_DATE_DATE_DAY_OF_YEAR_HPP
 
-
 #include <boost/cstdint.hpp>
 #include <boost/chrono/date/detail/bounded.hpp>
+#include <boost/chrono/date/detail/helpers.hpp>
 
 namespace boost
 {
@@ -20,15 +20,18 @@
     /**
      * day_of_year tag
      */
- struct day_of_year_tag {};
+ struct day_of_year_tag
+ {
+ };
 
     /**
      * The class day_of_year is used to specify the day of the year when constructing a date. Its range is [1,366].
      */
- typedef bounded<day_of_year_tag, 1, 366, int_least16_t> day_of_year;
+ typedef bounded<day_of_year_tag, 1, 366, day_of_year_rep> day_of_year;
 
   } // chrono
 
 } // boost
 
 #endif // header
+

Modified: sandbox/chrono_date/boost/chrono/date/days_date.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/days_date.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/days_date.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -33,84 +33,101 @@
   {
 
     /**
- * The class days_date is a model of Date storing
+ * The class days_date is a concrete Date storing
      * - the number of @c days since an undetermined epoch.
+ *
+ * Provides
      */
     class days_date
     {
       // Store x. Total 32 bits
       boost::uint_least32_t x_;
 
+ static BOOST_CONSTEXPR bool is_valid_(boost::uint_least32_t x) BOOST_NOEXCEPT
+ {
+ return x >= 11322 && x <= 23947853;
+ }
     public:
       /**
        * Effects: Constructs a @c days_date as if by @c year(0)/jan/1.
        * Note: the purpose of this constructor is to have a very efficient means
        * of @c days_date valid construction when the specific value for that @c days_date is unimportant.
        */
- days_date() BOOST_NOEXCEPT
+ BOOST_CONSTEXPR days_date() BOOST_NOEXCEPT
       : x_(11979588)
       {
       }
 
- /**
- * @Effect Constructs a @c days_date using the @c year, @c month, @c day stored in the arguments as follows:
- * If the value stored in @c d is outside the range of valid dates for the month @c m and year @c y,
- * throws an exception of type @c bad_date.
- * Else constructs a @c days_date for which <c>get_year() == y && get_month() == m && get_day() == d</c>.
- * @Throws bad_date if the specified days_date is invalid.
- */
- days_date(year y, month m, day d, check_t);
- //days_date(year::rep y, month m, day d);
- //days_date(year y, month::rep m, day d);
- //days_date(year y, month m, day::rep d);
+ //days_date(year_month_day ymd) BOOST_NOEXCEPT;
 
+// /**
+// * @Effect Constructs a @c days_date using the @c year, @c month, @c day stored in the arguments as follows:
+// * If the value stored in @c d is outside the range of valid dates for the month @c m and year @c y,
+// * throws an exception of type @c bad_date.
+// * Else constructs a @c days_date for which <c>year() == y && month() == m && day() == d</c>.
+// * @Throws bad_date if the specified days_date is invalid.
+// */
+// days_date(year y, month m, day d, check_t);
+// //days_date(year::rep y, month m, day d);
+// //days_date(year y, month::rep m, day d);
+// //days_date(year y, month m, day::rep d);
+//
       /**
        * @Effect Constructs a @c days_date constructor from @c year, @c month, @c day stored in the arguments as follows:
- * Constructs a @c days_date so that <c>get_year() == y && get_month() == m && get_day() == d</c>.
+ * Constructs a @c days_date so that <c>year() == y && month() == m && day() == d</c>.
        * @Note This function doesn't check the parameters validity.
        * It is up to the user to provide a valid ones.
        */
       days_date(year y, month m, day d) BOOST_NOEXCEPT;
- /**
- * @Effect Constructs a @c days_date using the @c year, @c month_day stored in the arguments as follows:
- * If the value stored in @c md is outside the range of valid dates for the year @c y,
- * throws an exception of type @c bad_date.
- * Else constructs a @c days_date for which <c>get_year() == y && get_month() == md.get_month() && get_day() == md.get_day()</c>.
- *
- * @Throws @c bad_date if the specified @c days_date is invalid.
- * @Note This constructor can be more efficient as the @c month_day is already valid.
- */
- days_date(year y, month_day md, check_t);
- /**
- * @Effect Constructs a @c days_date using the @c year, @c month_day stored in the arguments as follows:
- * Constructs a @c days_date for which <c>get_year() == y && get_month() == md.get_month() && get_day() == md.get_day()</c>.
- * @Note This function doesn't check the parameters validity.
- * It is up to the user to provide a valid ones.
- */
- days_date(year, month_day) BOOST_NOEXCEPT;
-
- /**
- * @Effect Constructs a @c days_date using the @c year, @c day_of_year stored in the arguments as follows:
- * If the value stored in @c doy is @c 366 and @c year.is_leap()
- * throws an exception of type @c bad_date.
- * Else constructs a @c days_date for which <c>days_since_epoch() == y.days_since_epoch()+doy.value()<c>
- * @Throws @c bad_date if the specified @c days_date is invalid.
- * @Note This constructor can be more efficient as the check is simpler.
- */
- days_date(year y, day_of_year doy, check_t);
- /**
- * @Effect Constructs a days_date using the year, day_of_year stored in the arguments as follows:
- * Constructs a days_date for which days_since_epoch() == y.days_since_epoch()+doy.value()
- * @Note This function doesn't check the parameters validity.
- * It is up to the user to provide a valid ones.
- */
- days_date(year y, day_of_year doy) BOOST_NOEXCEPT;
+// /**
+// * @Effect Constructs a @c days_date using the @c year, @c month_day stored in the arguments as follows:
+// * If the value stored in @c md is outside the range of valid dates for the year @c y,
+// * throws an exception of type @c bad_date.
+// * Else constructs a @c days_date for which <c>year() == y && month() == md.month() && day() == md.day()</c>.
+// *
+// * @Throws @c bad_date if the specified @c days_date is invalid.
+// * @Note This constructor can be more efficient as the @c month_day is already valid.
+// */
+// days_date(year y, month_day md, check_t);
+// /**
+// * @Effect Constructs a @c days_date using the @c year, @c month_day stored in the arguments as follows:
+// * Constructs a @c days_date for which <c>year() == y && month() == md.month() && day() == md.day()</c>.
+// * @Note This function doesn't check the parameters validity.
+// * It is up to the user to provide a valid ones.
+// */
+// days_date(year, month_day) BOOST_NOEXCEPT;
+//
+// /**
+// * @Effect Constructs a @c days_date using the @c year, @c day_of_year stored in the arguments as follows:
+// * If the value stored in @c doy is @c 366 and @c year.is_leap()
+// * throws an exception of type @c bad_date.
+// * Else constructs a @c days_date for which <c>days_since_epoch() == y.days_since_epoch()+doy.value()<c>
+// * @Throws @c bad_date if the specified @c days_date is invalid.
+// * @Note This constructor can be more efficient as the check is simpler.
+// */
+// days_date(year y, day_of_year doy, check_t);
+// /**
+// * @Effect Constructs a days_date using the year, day_of_year stored in the arguments as follows:
+// * Constructs a days_date for which days_since_epoch() == y.days_since_epoch()+doy.value()
+// * @Note This function doesn't check the parameters validity.
+// * It is up to the user to provide a valid ones.
+// */
+// days_date(year y, day_of_year doy) BOOST_NOEXCEPT;
 
       /**
        * @Effect Constructs a @c days_date using the @c days given as parameter so that:
        * <c>days_since_epoch() == ds.count()</c>.
        * @Throws @bad_date if the days is not in the range [11322,23947853].
        */
+#ifndef BOOST_NO_CXX11_CONSTEXPR
+ BOOST_CONSTEXPR explicit days_date(days d, check_t)
+ : x_(
+ is_valid_(d.count())
+ ? d.count()
+ : throw bad_date("days " + to_string(d.count()) + " is out of range")
+ )
+ {}
+#else
       explicit days_date(days d, check_t)
       : x_(d.count())
       {
@@ -119,7 +136,7 @@
           throw_exception( bad_date("days " + to_string(d.count()) + " is out of range") );
         }
       }
-
+#endif
       /**
        * Unchecked constructor from @c days
        * @Effect Constructs a @c days_date using the @c x.count() days given as parameter so that:
@@ -127,7 +144,7 @@
        * @Note This function doesn't check the parameters validity.
        * It is up to the user to provide a valid ones.
        */
- days_date(days d) BOOST_NOEXCEPT
+ BOOST_CONSTEXPR explicit days_date(days d) BOOST_NOEXCEPT
       : x_(d.count())
       {
       }
@@ -144,7 +161,7 @@
 // }
 // /**
 // * @Effect Constructs a @c days_date constructor from @c year, @c month, @c day stored in the arguments as follows:
-// * Constructs a @c days_date so that <c>get_year() == y && get_month() = m && get_day() == d</c>.
+// * Constructs a @c days_date so that <c>year() == y && month() = m && day() == d</c>.
 // * @Note This function doesn't check the parameters validity.
 // * It is up to the user to provide a valid ones.
 // */
@@ -152,125 +169,171 @@
 // : x_(x)
 // {
 // }
- /**
- * @Effect Constructs a @c days_date constructor from @c year::rep, @c month::rep, @c day::rep and
- * if the year is leap stored in the arguments as follows:
- * Constructs a @c days_date so that <c>get_year() == y && get_month() = m && get_day() == d</c>.
- * @Note This function doesn't check the parameters validity.
- * It is up to the user to provide a valid ones.
- */
- days_date(year::rep, month::rep, day::rep, bool) BOOST_NOEXCEPT;
+// /**
+// * @Effect Constructs a @c days_date constructor from @c year::rep, @c month::rep, @c day::rep and
+// * if the year is leap stored in the arguments as follows:
+// * Constructs a @c days_date so that <c>year() == y && month() = m && day() == d</c>.
+// * @Note This function doesn't check the parameters validity.
+// * It is up to the user to provide a valid ones.
+// */
+// days_date(year::rep, month::rep, day::rep, bool) BOOST_NOEXCEPT;
 
       // setters
- /**
- * @Effects Update the @c days_date if the parameters @c year, @c month, @c day represents a valid date.
- * @Returns @c true if the parameters represents a valid date.
- */
- bool set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT;
- /**
- * @Effects Update the days_date if the parameters represents a valid date.
- * @Returns @c true if the parameters represents a valid date.
- */
- bool set_if_valid_date(year y, day_of_year doy) BOOST_NOEXCEPT;
+// /**
+// * @Effects Update the @c days_date if the parameters @c year, @c month, @c day represents a valid date.
+// * @Returns @c true if the parameters represents a valid date.
+// */
+// bool set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT;
+// /**
+// * @Effects Update the days_date if the parameters represents a valid date.
+// * @Returns @c true if the parameters represents a valid date.
+// */
+// bool set_if_valid_date(year y, day_of_year doy) BOOST_NOEXCEPT;
       /**
        * @Effects Update the days_date if the parameter represents a valid days_date.
        * @Returns true if the parameters represents a valid days_date.
        */
       bool set_if_valid_date(days d) BOOST_NOEXCEPT;
 
- // factories
- /**
- * @Return A days_date which represents the current day taking the local time zone into account.
- */
- static days_date today() BOOST_NOEXCEPT;
+// // factories
+// /**
+// * @Return A days_date which represents the current day taking the local time zone into account.
+// */
+// static days_date today() BOOST_NOEXCEPT;
 
 
- // Conversions
- /**
- * @Effects: @c tp is converted to UTC, and then truncated to 00:00:00 hours.
- * A @c days_date is created which reflects this point in time.
- * @Throws If the conversion from @c tp overflows the range of @c days_date, throws
- * an exception of type @c bad_date.
- *
- */
- explicit days_date(system_clock::time_point tp);
- /**
- * @Returns: A system_clock::time_point which represents the @c days_date
- * referred to by *this at 00:00:00 UTC.
- *
- * @Throws: If the conversion to @c tp overflows the range of
- * system_clock::time_point, throws an exception of type @c bad_date.
- *
- */
- // explicit
- operator system_clock::time_point () const;
+// // Conversions
+// /**
+// * @Effects: @c tp is converted to UTC, and then truncated to 00:00:00 hours.
+// * A @c days_date is created which reflects this point in time.
+// * @Throws If the conversion from @c tp overflows the range of @c days_date, throws
+// * an exception of type @c bad_date.
+// *
+// */
+// explicit days_date(system_clock::time_point tp);
+// /**
+// * @Returns: A system_clock::time_point which represents the @c days_date
+// * referred to by *this at 00:00:00 UTC.
+// *
+// * @Throws: If the conversion to @c tp overflows the range of
+// * system_clock::time_point, throws an exception of type @c bad_date.
+// *
+// */
+// // explicit
+// operator system_clock::time_point () const;
 
 
       // Observers
       /**
        * @return @c true if the stored days are in the range [11322,23947853].
        */
- bool is_valid() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
       {
- return x_ >= 11322 && x_ <= 23947853;
+ return is_valid_(x_);
       }
 
       /**
        * @Returns: the number of days since an undefined epoch.
        */
- days days_since_epoch()
+ BOOST_CONSTEXPR days days_since_epoch() BOOST_NOEXCEPT
       {
         return days(x_);
       }
 
       /**
- * Returns: <c>day(d_)</c>.
+ * Returns: <c>chrono::day(d_)</c>.
+ *
+ * @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
        */
- day get_day() const BOOST_NOEXCEPT
+ chrono::day to_day() const BOOST_NOEXCEPT
       {
- return day(day_from_day_number());
+ return chrono::day(day_from_day_number());
       }
+// /**
+// * Returns: <c>chrono::day(d_)</c>.
+// */
+// chrono::day day() const BOOST_NOEXCEPT
+// {
+// return to_day();
+// }
       /**
- * Returns: <c>month(m_)</c>.
+ * Returns: <c>chrono::month(m_)</c>.
+ *
+ * @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
        */
- month get_month() const BOOST_NOEXCEPT
+ chrono::month to_month() const BOOST_NOEXCEPT
       {
- return month(month_from_day_number());
+ return chrono::month(month_from_day_number());
       }
+// /**
+// * Returns: <c>chrono::month(m_)</c>.
+// */
+// chrono::month month() const BOOST_NOEXCEPT
+// {
+// return to_month();
+// }
       /**
- * Returns: <c>year(y_)</c>.
+ * Returns: <c>chrono::year(y_)</c>.
+ *
+ * @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
        */
- year get_year() const BOOST_NOEXCEPT
+ chrono::year to_year() const BOOST_NOEXCEPT
       {
- return year(year_from_day_number());
+ return chrono::year(year_from_day_number());
       }
+// /**
+// * Returns: <c>chrono::year(y_)</c>.
+// */
+// chrono::year year() const BOOST_NOEXCEPT
+// {
+// return to_year();
+// }
       /**
        * Returns: @c true if @c year() is a leap year, and @c false otherwise.
+ *
+ * @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
        */
- bool is_leap_year() const BOOST_NOEXCEPT
+ bool to_is_leap_year() const BOOST_NOEXCEPT
       {
         return leap_from_day_number();
       }
+// /**
+// * Returns: @c true if @c year() is a leap year, and @c false otherwise.
+// */
+// bool is_leap_year() const BOOST_NOEXCEPT
+// {
+// return to_is_leap_year();
+// }
       /**
        * @return the @c month_day built from the @c month and @c day associated to the date.
        */
- month_day get_month_day() const BOOST_NOEXCEPT;
+ chrono::month_day month_day() const BOOST_NOEXCEPT;
       /**
        * @return the @c year_month built from the @c year and @c month associated to the date.
        */
- year_month get_year_month() const BOOST_NOEXCEPT;
+ chrono::year_month year_month() const BOOST_NOEXCEPT;
       /**
        * @return the @c year_month_day built from the @c year, @c month and @c day associated to the date.
        */
- year_month_day get_year_month_day() const BOOST_NOEXCEPT;
+ chrono::year_month_day year_month_day() const BOOST_NOEXCEPT;
 
       /**
        * @Returns: A weekday constructed with an int corresponding to *this
        * days_date's day of the week (a value in the range of [0 - 6], 0 is Sunday).
        */
- weekday get_weekday() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR chrono::weekday to_weekday() const BOOST_NOEXCEPT
       {
- return weekday((x_ + 1) % weekday::size);
+ return chrono::weekday((x_ + 1) % weekday::size);
+ }
+
+ /**
+ * @Returns: A weekday constructed with an int corresponding to *this
+ * days_date's day of the week (a value in the range of [0 - 6], 0 is Sunday).
+ */
+ //BOOST_CONSTEXPR chrono::weekday weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
+ {
+ return to_weekday();
       }
 
       // Days Based Arithmetic
@@ -330,198 +393,197 @@
        * @Returns: <c>dt += d</c>.
        *
        */
- friend days_date operator+(days_date dt, days d)
+ friend BOOST_CONSTEXPR days_date operator+(days_date dt, days d)
       {
- dt += d;
- return dt;
+ return days_date(dt.days_since_epoch()+d);
       }
       /**
        * @Returns: <c>dt += d</c>.
        *
        */
- friend days_date operator+(days d, days_date dt)
+ friend BOOST_CONSTEXPR days_date operator+(days d, days_date dt)
       {
- dt += d;
- return dt;
+ return days_date(dt.days_since_epoch()+d);
       }
       /**
        * @Returns: <c>dt -= d</c>.
        *
        */
- friend days_date operator-(days_date dt, days d)
+ friend BOOST_CONSTEXPR days_date operator-(days_date dt, days d)
       {
- dt -= d;
- return dt;
+ return days_date(dt.days_since_epoch()-d);
       }
       /**
        * @Returns: Computes the number of days @c x is ahead of @c y in the calendar,
        * and returns that signed integral number @c n as days(n).
        */
- friend days operator-(days_date x, days_date y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR days operator-(days_date x, days_date y) BOOST_NOEXCEPT
       {
         return x.days_since_epoch() - y.days_since_epoch();
       }
 
- // Month Based Arithmetic
-
- /**
- * @Effects Adds @c m.count() months to the current date.
- * This is accomplished as if by storing temporary values of the days_date's @c year @c y_, @c month @c m_, @c day @c _d.
- * Computing new values for @c y_ and @c m_ based on @c m. And then assigning to
- * @c *this a new @c days_date constructed from the newly computed @c y_ and @c m_, and the
- * original @c d_.
- *
- * @Returns: @c *this.
- *
- * @Throws: If the addition would create a @c days_date with a @c y_ outside of the
- * range of @c year, or a @c d_ outside the range for the newly computed @c y_/@c m_,
- * throws an exception of type @c bad_date.
- *
- */
- days_date& operator+=(months m);
-
- /**
- * Returns: <c>*this += -m</c>.
- */
- days_date& operator-=(months m)
- {
- return *this += months(-m.count());
- }
-
- /**
- * @Returns: <c>dt += m</c>.
- *
- */
- friend days_date operator+(days_date dt, months m)
- {
- dt += m;
- return dt;
- }
- /**
- * @Returns: <c>dt += m</c>.
- *
- */
- friend days_date operator+(months m, days_date dt)
- {
- dt += m;
- return dt;
- }
- /**
- * @Returns: <c>dt += -m</c>.
- *
- */
- friend days_date operator-(days_date dt, months m)
- {
- dt -= m;
- return dt;
- }
-
- // Years Based Arithmetic
-
- /*
- * @Effects: Adds @c y.count() years to the current date.
- * This is accomplished as if by storing temporary values of the days_date's
- * @c year @c y_, @c month @c m_, @c day @c d_. Computing a new value for @c y_. And then assigning to @c *this
- * a new @c days_date constructed from the newly computed @c y_, and the original @c m_, @c d_.
- * @Returns: @c *this.
- * @Throws: If the addition would create a @c days_date with a @c y_ outside of the
- * range of @c year, or a @c d_ outside the range for the newly computed @c y_/@c m_,
- * throws an exception of type @c bad_date.
- */
- days_date& operator+=(years y);
-
- /**
- * @Returns: <c>*this += -y</c>.
- *
- */
- days_date& operator-=(years y)
- {
- return *this += years(-y.count());
- }
-
- /**
- * @Returns: <c>dt += y</c>.
- *
- */
- friend days_date operator+(days_date dt, years y)
- {
- dt += y;
- return dt;
- }
- /**
- * @Returns: <c>dt += y</c>.
- *
- */
- friend days_date operator+(years y, days_date dt)
- {
- dt += y;
- return dt;
- }
- /**
- * @Returns: <c>dt -= y</c>.
- *
- */
- friend days_date operator-(days_date dt, years y)
- {
- dt -= y;
- return dt;
- }
+// // Month Based Arithmetic
+//
+// /**
+// * @Effects Adds @c m.count() months to the current date.
+// * This is accomplished as if by storing temporary values of the days_date's @c year @c y_, @c month @c m_, @c day @c _d.
+// * Computing new values for @c y_ and @c m_ based on @c m. And then assigning to
+// * @c *this a new @c days_date constructed from the newly computed @c y_ and @c m_, and the
+// * original @c d_.
+// *
+// * @Returns: @c *this.
+// *
+// * @Throws: If the addition would create a @c days_date with a @c y_ outside of the
+// * range of @c year, or a @c d_ outside the range for the newly computed @c y_/@c m_,
+// * throws an exception of type @c bad_date.
+// *
+// */
+// days_date& operator+=(months m);
+//
+// /**
+// * Returns: <c>*this += -m</c>.
+// */
+// days_date& operator-=(months m)
+// {
+// return *this += months(-m.count());
+// }
+//
+// /**
+// * @Returns: <c>dt += m</c>.
+// *
+// */
+// friend days_date operator+(days_date dt, months m)
+// {
+// dt += m;
+// return dt;
+// }
+// /**
+// * @Returns: <c>dt += m</c>.
+// *
+// */
+// friend days_date operator+(months m, days_date dt)
+// {
+// dt += m;
+// return dt;
+// }
+// /**
+// * @Returns: <c>dt += -m</c>.
+// *
+// */
+// friend days_date operator-(days_date dt, months m)
+// {
+// dt -= m;
+// return dt;
+// }
+//
+// // Years Based Arithmetic
+//
+// /*
+// * @Effects: Adds @c y.count() years to the current date.
+// * This is accomplished as if by storing temporary values of the days_date's
+// * @c year @c y_, @c month @c m_, @c day @c d_. Computing a new value for @c y_. And then assigning to @c *this
+// * a new @c days_date constructed from the newly computed @c y_, and the original @c m_, @c d_.
+// * @Returns: @c *this.
+// * @Throws: If the addition would create a @c days_date with a @c y_ outside of the
+// * range of @c year, or a @c d_ outside the range for the newly computed @c y_/@c m_,
+// * throws an exception of type @c bad_date.
+// */
+// days_date& operator+=(years y);
+//
+// /**
+// * @Returns: <c>*this += -y</c>.
+// *
+// */
+// days_date& operator-=(years y)
+// {
+// return *this += years(-y.count());
+// }
+//
+// /**
+// * @Returns: <c>dt += y</c>.
+// *
+// */
+// friend days_date operator+(days_date dt, years y)
+// {
+// dt += y;
+// return dt;
+// }
+// /**
+// * @Returns: <c>dt += y</c>.
+// *
+// */
+// friend days_date operator+(years y, days_date dt)
+// {
+// dt += y;
+// return dt;
+// }
+// /**
+// * @Returns: <c>dt -= y</c>.
+// *
+// */
+// friend days_date operator-(days_date dt, years y)
+// {
+// dt -= y;
+// return dt;
+// }
 
       // Relational operators
       /**
        * Returns: <c>x.days_since_epoch() == y.days_since_epoch()</c>.
        */
- friend bool operator==(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator==(const days_date& x, const days_date& y) BOOST_NOEXCEPT
       {
         return x.x_ == y.x_;
       }
       /**
        * Returns: <c>x.days_since_epoch() < y.days_since_epoch()</c>.
        */
- friend bool operator< (const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator< (const days_date& x, const days_date& y) BOOST_NOEXCEPT
       {
         return x.x_ < y.x_;
       }
       /**
        * @Returns: <c>!(x == y)</c>.
        */
- friend bool operator!=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator!=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
       {
         return !(x == y);
       }
       /**
        * @Returns: <c>y < x</c>.
        */
- friend bool operator> (const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator> (const days_date& x, const days_date& y) BOOST_NOEXCEPT
       {
         return y < x;
       }
       /**
        * @Returns: <c>!(y < x)</c>.
        */
- friend bool operator<=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator<=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
       {
         return !(y < x);
       }
       /**
        * @Returns: <c>!(x < y)</c>.
        */
- friend bool operator>=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator>=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
       {
         return !(x < y);
       }
 
 
+#if ! defined BOOST_CHRONO_DATE_DOXYGEN_INVOKED
     private:
 
       day::rep day_from_day_number() const BOOST_NOEXCEPT;
       month::rep month_from_day_number() const BOOST_NOEXCEPT;
       year::rep year_from_day_number() const BOOST_NOEXCEPT;
       bool leap_from_day_number() const BOOST_NOEXCEPT;
+#endif
     };
 
     /**
- * Partial specialization of @c is_date<days_date> as a true type.
+ * Partial specialization of @c is_date<days_date> as @c true_type.
      */
     template <>
     struct is_date<days_date> : true_type {};

Modified: sandbox/chrono_date/boost/chrono/date/detail/bounded.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/detail/bounded.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/detail/bounded.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -42,7 +42,7 @@
       /**
        * @Effects: Constructs an object of class @c bounded by storing @c d.
        * @Postconditions: <c>value() == d && is_valid()</c>.
- * @Throws: if @c d is outside of the range [first, last], throws an exception of type @c std::logic_error.
+ * @Throws: if @c d is outside of the range [first, last], throws an exception of type @c std::out_of_range.
        */
 
 #ifndef BOOST_NO_CXX11_CONSTEXPR
@@ -50,7 +50,7 @@
       : value_(
           is_valid_(d)
           ? d
- : throw std::logic_error("bounded " + boost::chrono::to_string(int(d)) + " is out of range")
+ : throw std::out_of_range("bounded " + boost::chrono::to_string(int(d)) + " is out of range")
         )
       {}
 #else
@@ -58,7 +58,7 @@
       : value_(d)
       {
         if (!is_valid_(d))
- throw std::logic_error("bounded " + boost::chrono::to_string(int(d)) + " is out of range");
+ throw std::out_of_range("bounded " + boost::chrono::to_string(int(d)) + " is out of range");
       }
 #endif
       /**

Modified: sandbox/chrono_date/boost/chrono/date/detail/helpers.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/detail/helpers.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/detail/helpers.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -15,42 +15,57 @@
 {
   namespace chrono
   {
-
- typedef boost::int_least8_t day_rep;
     typedef boost::int_least64_t days_rep;
- typedef boost::int_least8_t month_rep;
- typedef boost::int_least16_t day_of_year_rep;
+ typedef int day_rep;
+ typedef int month_rep;
+ typedef int day_of_year_rep;
     typedef boost::int_least32_t year_rep;
-
- inline bool
+//#ifdef __clang__
+// typedef boost::int_least32_t day_rep;
+// typedef boost::int_least32_t month_rep;
+// typedef boost::int_least32_t day_of_year_rep;
+// typedef boost::int_least32_t year_rep;
+//#else
+// typedef boost::int_least32_t day_rep;
+// typedef boost::int_least32_t month_rep;
+// typedef boost::int_least32_t day_of_year_rep;
+// typedef boost::int_least32_t year_rep;
+//#endif
+ inline BOOST_CONSTEXPR bool
     is_leap(year_rep y)
     BOOST_NOEXCEPT
     {
       return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
     }
 
- inline days_rep days_before_year(year_rep y)
+ inline BOOST_CONSTEXPR days_rep days_before_year(year_rep y)
     {
       return y * 365 + y / 4 - y / 100 + y / 400;
     }
 
- inline year_rep
+ inline BOOST_CONSTEXPR year_rep
     to_average_year(days_rep ds)
     BOOST_NOEXCEPT
     {
       return static_cast<year_rep>(static_cast<int64_t>(ds+2) * 400 / 146097);
     }
 
+ //BOOST_CONSTEXPR
     day_rep days_in_month(bool, month_rep)
     BOOST_NOEXCEPT;
+ //BOOST_CONSTEXPR
     day_of_year_rep days_in_year_before(bool, month_rep)
     BOOST_NOEXCEPT;
+ //BOOST_CONSTEXPR
     const day_of_year_rep* days_in_year_before(bool)
     BOOST_NOEXCEPT;
+ //BOOST_CONSTEXPR
     month_rep day_of_year_month(bool, day_of_year_rep)
     BOOST_NOEXCEPT;
+ //BOOST_CONSTEXPR
     day_rep day_of_year_day_of_month(bool, day_of_year_rep)
     BOOST_NOEXCEPT;
+ //BOOST_CONSTEXPR
     day_of_year_rep month_day_to_day_of_year(bool, month_rep, day_rep)
 BOOST_NOEXCEPT ;
 

Modified: sandbox/chrono_date/boost/chrono/date/include.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/include.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/include.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -8,7 +8,6 @@
 #ifndef BOOST_CHRONO_DATE_INCLUDE_HPP
 #define BOOST_CHRONO_DATE_INCLUDE_HPP
 
-#include <boost/chrono/date/no_check.hpp>
 #include <boost/chrono/date/exceptions.hpp>
 
 #include <boost/chrono/date/date_durations.hpp>
@@ -34,6 +33,7 @@
 #include <boost/chrono/date/date_generators.hpp>
 
 #include <boost/chrono/date/relative_date.hpp>
+#include <boost/chrono/date/no_check.hpp>
 
 
 /*
@@ -55,10 +55,10 @@
  explicit operator boost::chrono::system_clock::time_point () const;
 
  // obervers
- day get_day() const noexcept;
- month get_month() const noexcept;
- year get_year() const noexcept;
- weekday get_weekday() const noexcept;
+ day day() const noexcept;
+ month month() const noexcept;
+ year year() const noexcept;
+ weekday weekday() const noexcept;
  bool is_leap_year() const noexcept;
 
  // day arithmetic

Modified: sandbox/chrono_date/boost/chrono/date/month.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/month.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/month.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -10,6 +10,7 @@
 #define BOOST_CHRONO_DATE_MONTH_HPP
 
 #include <boost/cstdint.hpp>
+#include <boost/chrono/date/detail/helpers.hpp>
 #include <boost/chrono/date/detail/bounded.hpp>
 #include <boost/chrono/date/detail/helpers.hpp>
 #include <boost/chrono/date/date_durations.hpp>
@@ -27,9 +28,9 @@
     /**
      * The class @c month is used to specify the month of the year when constructing a date. Its range is [1,12].
      */
- class month: public bounded<month_tag, 1, 12, int_least8_t>
+ class month: public bounded<month_tag, 1, 12, month_rep>
     {
- typedef bounded<month_tag, 1, 12, int_least8_t> base_type;
+ typedef bounded<month_tag, 1, 12, month_rep> base_type;
     public:
       /**
        * @Effects: Constructs an object of class month by storing m.
@@ -61,34 +62,19 @@
     /**
      * month pseudo-literals.
      */
-#ifndef BOOST_NO_CXX11_CONSTEXPR
- BOOST_CONSTEXPR_OR_CONST month jan(1);
- BOOST_CONSTEXPR_OR_CONST month feb(2);
- BOOST_CONSTEXPR_OR_CONST month mar(3);
- BOOST_CONSTEXPR_OR_CONST month apr(4);
- BOOST_CONSTEXPR_OR_CONST month may(5);
- BOOST_CONSTEXPR_OR_CONST month jun(6);
- BOOST_CONSTEXPR_OR_CONST month jul(7);
- BOOST_CONSTEXPR_OR_CONST month aug(8);
- BOOST_CONSTEXPR_OR_CONST month sep(9);
- BOOST_CONSTEXPR_OR_CONST month oct(10);
- BOOST_CONSTEXPR_OR_CONST month nov(11);
- BOOST_CONSTEXPR_OR_CONST month dec(12);
-#else
- extern const month jan;
- extern const month feb;
- extern const month mar;
- extern const month apr;
- extern const month may;
- extern const month jun;
- extern const month jul;
- extern const month aug;
- extern const month sep;
- extern const month oct;
- extern const month nov;
- extern const month dec;
 
-#endif
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, jan, 1);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, feb, 2);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, mar, 3);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, apr, 4);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, may, 5);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, jun, 6);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, jul, 7);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, aug, 8);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, sep, 9);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, oct, 10);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, nov, 11);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(month, dec, 12);
 
     /**
      * Overload for month conversion to string.

Modified: sandbox/chrono_date/boost/chrono/date/month_nth.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/month_nth.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/month_nth.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -10,7 +10,7 @@
 #define BOOST_CHRONO_DATE_MONTH_NTH_HPP
 
 #include <boost/cstdint.hpp>
-#include <boost/chrono/config.hpp>
+#include <boost/chrono/date/config.hpp>
 #include <boost/chrono/date/nth.hpp>
 #include <boost/chrono/date/no_check.hpp>
 #include <boost/chrono/date/exceptions.hpp>
@@ -33,7 +33,7 @@
     public:
       /**
        * @Effects: Constructs an object of class @c month_nth by storing @c m and @c d.
- * @Postconditions: get_month() == m && get_nth() == d && is_valid().
+ * @Postconditions: month() == m && nth() == d && is_valid().
        * @Throws: if d is outside of the valid range of days of month @c m, throws an exception of type bad_date.
        */
       month_nth(month m, nth d, check_t)
@@ -47,11 +47,11 @@
       }
       /**
        * @Effects: Constructs an object of class @c month_nth by storing @c m and @c d.
- * @Postconditions: get_month() == m && get_nth() == d.
+ * @Postconditions: month() == m && nth() == d.
        * @Note This function doesn't check the parameters validity.
        * It is up to the user to provide the valid ones.
        */
- month_nth(month m, nth d) BOOST_NOEXCEPT
+ BOOST_CONSTEXPR month_nth(month m, nth d) BOOST_NOEXCEPT
       : m_(m),
       d_(d)
       {
@@ -59,14 +59,16 @@
       /**
        * @Return the @c month component.
        */
- month get_month() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
       /**
        * @Return the @c nth component.
        */
- nth get_nth() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR nth nth() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::nth() const BOOST_NOEXCEPT
       {
         return d_;
       }
@@ -82,69 +84,20 @@
      * @Return a the @c month_nth with the associated parameters.
      * @Throws if d is outside of the valid range of days of month @c m, throws an exception of type bad_date.
      */
- inline month_nth operator/(month m, nth d)
+ inline BOOST_CONSTEXPR month_nth operator/(chrono::month m, nth d)
     BOOST_NOEXCEPT
     {
       return month_nth(m, d);
     }
- inline month_nth operator/(month m, last_t)
- BOOST_NOEXCEPT
- {
- return month_nth(m, nth(6));
- }
- inline month_nth operator/(month m, _1st_t) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(1));
- }
- inline month_nth operator/(month m, _2nd_t) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(2));
- }
- inline month_nth operator/(month m, _3rd_t) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(3));
- }
- inline month_nth operator/(month m, _4th_t) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(4));
- }
- inline month_nth operator/(month m, _5th_t) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(5));
- }
+
     /**
      * @Returns the @c month_nth with the associated parameters.
      * @Throws if @c d is outside of the valid range of days of month @c m, throws an exception of type bad_date.
      */
- inline month_nth operator/(nth d, month m)
+ inline BOOST_CONSTEXPR month_nth operator/(nth d, chrono::month m)
 BOOST_NOEXCEPT {
     return month_nth(m, d);
   }
- inline month_nth operator/(last_t, month m)
-BOOST_NOEXCEPT {
- return month_nth(m, nth(6));
- }
-
- inline month_nth operator/(_1st_t, month m) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(1));
- }
- inline month_nth operator/(_2nd_t, month m) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(2));
- }
- inline month_nth operator/(_3rd_t, month m) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(3));
- }
- inline month_nth operator/(_4th_t, month m) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(4));
- }
- inline month_nth operator/(_5th_t, month m) BOOST_NOEXCEPT
- {
- return month_nth(m, nth(5));
- }
 
 
 } // chrono

Modified: sandbox/chrono_date/boost/chrono/date/month_nth_weekday.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/month_nth_weekday.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/month_nth_weekday.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -11,7 +11,7 @@
 
 
 #include <boost/cstdint.hpp>
-#include <boost/chrono/config.hpp>
+#include <boost/chrono/date/config.hpp>
 #include <boost/chrono/date/no_check.hpp>
 #include <boost/chrono/date/nth.hpp>
 #include <boost/chrono/date/nth_week.hpp>
@@ -32,7 +32,7 @@
     public:
 // /**
 // * @Effects: Constructs an object of class @c month_nth_weekday by storing @c m and @c nwd.
-// * @Postconditions: get_month() == m && get_nth_weekday() == nwd && is_valid().
+// * @Postconditions: month() == m && nth_weekday() == nwd && is_valid().
 // */
 // month_nth_weekday(month m, nth_weekday nwd, check_t) BOOST_NOEXCEPT
 // : m_(m, check),
@@ -42,11 +42,11 @@
 // }
       /**
        * @Effects: Constructs an object of class @c month_nth_weekday by storing @c m and @c nwd.
- * @Postconditions: get_month() == m && get_nth_weekday() == nwd.
+ * @Postconditions: month() == m && nth_weekday() == nwd.
        * @Note This function doesn't check the parameters validity.
        * It is up to the user to provide a valid ones.
        */
- month_nth_weekday(month::rep m, nth_weekday d) BOOST_NOEXCEPT
+ BOOST_CONSTEXPR month_nth_weekday(month::rep m, nth_weekday d) BOOST_NOEXCEPT
       : m_(m),
       d_(d)
       {
@@ -54,21 +54,23 @@
       /**
        * @Return the @c month component.
        */
- month get_month() const BOOST_NOEXCEPT
+ //month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
       /**
        * @Return the @c nth_weekday component.
        */
- nth_weekday get_nth_weekday() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR nth_weekday nth_weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::nth_weekday() const BOOST_NOEXCEPT
       {
         return d_;
       }
       /**
        * @Return if the stored value is a valid one.
        */
- bool is_valid() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
       {
         return ( m_.is_valid() && d_.is_valid() );
       }
@@ -77,14 +79,14 @@
     /**
      * @return a @c month_nth_weekday build with the given parameters.
      */
- inline month_nth_weekday operator/(month m, nth_weekday d) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR month_nth_weekday operator/(month m, nth_weekday d) BOOST_NOEXCEPT
     {
       return month_nth_weekday(m, d);
     }
     /**
      * @return a @c month_nth_weekday build with the given parameters.
      */
- inline month_nth_weekday operator/(nth_weekday d, month m) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR month_nth_weekday operator/(nth_weekday d, month m) BOOST_NOEXCEPT
     {
       return month_nth_weekday(m, d);
     }
@@ -104,14 +106,14 @@
       typedef int_least8_t rep;
       static const rep not_applicable=-31;
 
- dom(rep s) BOOST_NOEXCEPT : value_(s)
+ BOOST_CONSTEXPR dom(rep s) BOOST_NOEXCEPT : value_(s)
       {
       }
- rep value() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR rep value() const BOOST_NOEXCEPT
       {
         return value_;
       }
- bool is_not_applicable() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
       {
         return value_==not_applicable;
       }
@@ -124,26 +126,28 @@
       month m_; // :4
       dom d_; // :6
     public:
- month_dom(month m, dom d) BOOST_NOEXCEPT
+ BOOST_CONSTEXPR month_dom(month m, dom d) BOOST_NOEXCEPT
       : m_(m),
       d_(d)
       {
       }
- month get_month() const BOOST_NOEXCEPT
+ //month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
- dom get_dom() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR dom dom() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::dom() const BOOST_NOEXCEPT
       {
         return d_;
       }
     };
 
- inline month_dom operator/(month m, dom d) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR month_dom operator/(month m, dom d) BOOST_NOEXCEPT
     {
       return month_dom(m, d);
     }
- inline month_dom operator/(dom d, month m) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR month_dom operator/(dom d, month m) BOOST_NOEXCEPT
     {
       return month_dom(m, d);
     }

Modified: sandbox/chrono_date/boost/chrono/date/no_check.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/no_check.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/no_check.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -8,6 +8,7 @@
 #ifndef BOOST_CHRONO_DATE_NO_CHECK_HPP
 #define BOOST_CHRONO_DATE_NO_CHECK_HPP
 
+#include <boost/chrono/date/config.hpp>
 
 namespace boost
 {

Modified: sandbox/chrono_date/boost/chrono/date/nth.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/nth.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/nth.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -10,6 +10,7 @@
 #define BOOST_CHRONO_DATE_NTH_HPP
 
 #include <boost/cstdint.hpp>
+#include <boost/chrono/date/config.hpp>
 #include <boost/chrono/date/detail/bounded.hpp>
 
 namespace boost
@@ -19,15 +20,28 @@
     /**
      * nth tag
      */
- struct nth_tag {};
+ struct nth_tag
+ {
+ const int value_;
+ BOOST_CONSTEXPR nth_tag(int v) BOOST_NOEXCEPT
+ : value_(v)
+ {}
+ };
+
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(nth_tag, last, 0);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(nth_tag, _1st, 1);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(nth_tag, _2nd, 2);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(nth_tag, _3rd, 3);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(nth_tag, _4th, 4);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(nth_tag, _5th, 5);
 
     /**
      * The class nth is used to specify a small integral value that indicates the nth day of the month (example: last, 1st).
      * Its range is [1, 6].
      */
- class nth: public bounded<nth_tag, 1, 6, int_least8_t>
+ class nth: public bounded<nth_tag, 1, 6>
     {
- typedef bounded<nth_tag, 1, 6, int_least8_t> base_type;
+ typedef bounded<nth_tag, 1, 6> base_type;
 
     public:
       BOOST_STATIC_CONSTEXPR rep not_applicable=7;
@@ -46,25 +60,16 @@
           : base_type(s)
       {}
 
+ BOOST_CONSTEXPR nth(nth_tag s) BOOST_NOEXCEPT
+ : base_type(s.value_)
+ {}
+
       BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
       {
         return value()==not_applicable;
       }
     };
 
- struct last_t {};
- BOOST_CONSTEXPR_OR_CONST last_t last = {};
- struct _1st_t {};
- BOOST_CONSTEXPR_OR_CONST _1st_t _1st = {};
- struct _2nd_t {};
- BOOST_CONSTEXPR_OR_CONST _2nd_t _2nd = {};
- struct _3rd_t {};
- BOOST_CONSTEXPR_OR_CONST _3rd_t _3rd = {};
- struct _4th_t {};
- BOOST_CONSTEXPR_OR_CONST _4th_t _4th = {};
- struct _5th_t {};
- BOOST_CONSTEXPR_OR_CONST _5th_t _5th = {};
-
 
 
   } // chrono

Modified: sandbox/chrono_date/boost/chrono/date/nth_week.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/nth_week.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/nth_week.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -12,6 +12,7 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/chrono/date/detail/bounded.hpp>
+#include <boost/chrono/date/nth.hpp>
 
 namespace boost
 {
@@ -48,6 +49,9 @@
       BOOST_CONSTEXPR nth_week(int s) BOOST_NOEXCEPT
           : base_type(s)
       {}
+ BOOST_CONSTEXPR nth_week(nth_tag s) BOOST_NOEXCEPT
+ : base_type(s.value_)
+ {}
 
       BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
       {

Modified: sandbox/chrono_date/boost/chrono/date/nth_weekday.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/nth_weekday.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/nth_weekday.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -14,6 +14,7 @@
 #include <boost/chrono/config.hpp>
 #include <boost/chrono/date/nth.hpp>
 #include <boost/chrono/date/nth_week.hpp>
+#include <boost/chrono/date/weekday.hpp>
 #include <boost/chrono/date/no_check.hpp>
 
 namespace boost
@@ -67,14 +68,16 @@
       /**
        * @Return The nth stored component.
        */
- BOOST_CONSTEXPR nth_week get_nth() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR nth_week nth_week() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::nth_week() const BOOST_NOEXCEPT
       {
         return n_;
       }
       /**
        * @Return The weekday stored component.
        */
- BOOST_CONSTEXPR weekday get_weekday() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR weekday weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
       {
         return dow_;
       }
@@ -91,35 +94,6 @@
       return nth_weekday(nw, wd);
     }
 
- inline BOOST_CONSTEXPR nth_weekday operator*(last_t, weekday wd) BOOST_NOEXCEPT
- {
- return nth_weekday(nth_week(6), wd);
- }
- inline BOOST_CONSTEXPR nth_weekday operator*(_1st_t, weekday wd) BOOST_NOEXCEPT
- {
- return nth_weekday(nth_week(1), wd);
- }
- inline BOOST_CONSTEXPR nth_weekday operator*(_2nd_t, weekday wd) BOOST_NOEXCEPT
- {
- return nth_weekday(nth_week(2), wd);
- }
- inline BOOST_CONSTEXPR nth_weekday operator*(_3rd_t, weekday wd) BOOST_NOEXCEPT
- {
- return nth_weekday(nth_week(3), wd);
- }
- inline BOOST_CONSTEXPR nth_weekday operator*(_4th_t, weekday wd) BOOST_NOEXCEPT
- {
- return nth_weekday(nth_week(4), wd);
- }
- inline BOOST_CONSTEXPR nth_weekday operator*(_5th_t, weekday wd) BOOST_NOEXCEPT
- {
- return nth_weekday(nth_week(5), wd);
- }
- inline nth_weekday operator*(unsigned n, weekday wd)
- {
- return nth_weekday(nth_week(n), wd);
- }
-
     /**
      * nth_weekday pseudo-literals.
      */

Modified: sandbox/chrono_date/boost/chrono/date/relative_date.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/relative_date.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/relative_date.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -75,23 +75,23 @@
        * of @c rel_date valid construction when the specific value for that @c days_date is unimportant.
        */
       rel_date() BOOST_NOEXCEPT;
- rel_date(year, month, nth_weekday);
- rel_date(year, month, nth_weekday, check_t) BOOST_NOEXCEPT;
- rel_date(year, month, nth);
- rel_date(year, month, nth, check_t)BOOST_NOEXCEPT;
+ rel_date(chrono::year, chrono::month, nth_weekday);
+ rel_date(chrono::year, chrono::month, nth_weekday, check_t) BOOST_NOEXCEPT;
+ rel_date(chrono::year, chrono::month, nth);
+ rel_date(chrono::year, chrono::month, nth, check_t)BOOST_NOEXCEPT;
 #if BOOST_CHRONO_DATE_REL_DATE_IS_A_MODEL_OF_DATE
- rel_date(year, month, day); // TODO
- rel_date(year, month, day, check_t)BOOST_NOEXCEPT;// TODO
- rel_date(year y, month_day md);// TODO
- rel_date(year, month_day, check_t) BOOST_NOEXCEPT;// TODO
+ rel_date(chrono::year, chrono::month, chrono::day); // TODO
+ rel_date(chrono::year, chrono::month, chrono::day, check_t)BOOST_NOEXCEPT;// TODO
+ rel_date(chrono::year y, month_day md);// TODO
+ rel_date(chrono::year, month_day, check_t) BOOST_NOEXCEPT;// TODO
 
       explicit rel_date(days d);// TODO
 
- rel_date(year y, day_of_year doy);// TODO
- rel_date(year y, day_of_year doy, check_t) BOOST_NOEXCEPT;// TODO
+ rel_date(chrono::year y, day_of_year doy);// TODO
+ rel_date(chrono::year y, day_of_year doy, check_t) BOOST_NOEXCEPT;// TODO
 
- bool set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT;// TODO
- bool set_if_valid_date(year y, day_of_year doy) BOOST_NOEXCEPT;// TODO
+ bool set_if_valid_date(chrono::year y, chrono::month m, chrono::day d) BOOST_NOEXCEPT;// TODO
+ bool set_if_valid_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT;// TODO
       bool set_if_valid_date(days d) BOOST_NOEXCEPT;// TODO
 
       static rel_date today() BOOST_NOEXCEPT;// TODO
@@ -113,41 +113,51 @@
       //bool is_valid() const BOOST_NOEXCEPT;
 
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1 || BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
- day get_day() const BOOST_NOEXCEPT
+ chrono::day to_day() const BOOST_NOEXCEPT
       {
- std::cout << "KKKKKKKKKKKKK" << std::endl;
- if (d_!=0)
- return day(d_);
- else {
- std::cout << "KKKKKKKKKKKKK" << std::endl;
- return day(d_);
- }
-
+ return chrono::day(d_);
+ }
+ //chrono::day day() const BOOST_NOEXCEPT
+ operator chrono::day() const BOOST_NOEXCEPT
+ {
+ return to_day();
+ }
+ chrono::month to_month() const BOOST_NOEXCEPT
+ {
+ return chrono::month(m_);
+ }
+ //chrono::month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT operator chrono::month() const BOOST_NOEXCEPT
+ {
+ return chrono::month(m_);
       }
- month get_month() const BOOST_NOEXCEPT
+ chrono::year to_year() const BOOST_NOEXCEPT
       {
- return month(m_);
+ return chrono::year(y_);
       }
- year get_year() const BOOST_NOEXCEPT
+ //chrono::year year() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR
+ BOOST_CHRONO_EXPLICT operator chrono::year() const BOOST_NOEXCEPT
       {
- return year(y_);
+ return chrono::year(y_);
       }
       bool is_leap_year() const BOOST_NOEXCEPT
       {
         return leap_;
       }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
- day get_day() const BOOST_NOEXCEPT
+ //chrono::day day() const BOOST_NOEXCEPT
+ operator chrono::day() const BOOST_NOEXCEPT
       {
- return day(day_from_day_number());
+ return chrono::day(day_from_day_number());
       }
- month get_month() const BOOST_NOEXCEPT
+ chrono::month month() const BOOST_NOEXCEPT
       {
- return month(month_from_day_number());
+ return chrono::month(month_from_day_number());
       }
- year get_year() const BOOST_NOEXCEPT
+ chrono::year year() const BOOST_NOEXCEPT
       {
- return year(year_from_day_number());
+ return chrono::year(year_from_day_number());
       }
       bool is_leap_year() const BOOST_NOEXCEPT
       {
@@ -155,14 +165,16 @@
       }
 #endif
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1 || BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
- weekday get_weekday() const BOOST_NOEXCEPT
+ //chrono::weekday weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT operator chrono::weekday() const BOOST_NOEXCEPT
       {
- return weekday((x_+1) % weekday::size);
+ return chrono::weekday((x_+1) % weekday::size);
       }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
- weekday get_weekday() const BOOST_NOEXCEPT
+ //chrono::weekday weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT operator chrono::weekday() const BOOST_NOEXCEPT
       {
- return weekday((day_number_from_ymd()+1) % weekday::size);
+ return chrono::weekday((day_number_from_ymd()+1) % weekday::size);
       }
 #endif
 
@@ -229,17 +241,17 @@
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
       friend days operator-(rel_date x, rel_date y) BOOST_NOEXCEPT
       {
- return x.days_since_epoch() - y.days_since_epoch();
+ return days_date(x).days_since_epoch() - days_date(y).days_since_epoch();
       }
 #endif
       friend days operator-(rel_date x, ymd_date y) BOOST_NOEXCEPT
       {
- return x.days_since_epoch() - y.days_since_epoch();
+ return days_date(x).days_since_epoch() - days_date(y).days_since_epoch();
       }
 
       friend days operator-(ymd_date x, rel_date y) BOOST_NOEXCEPT
       {
- return x.days_since_epoch() - y.days_since_epoch();
+ return days_date(x).days_since_epoch() - days_date(y).days_since_epoch();
       }
 
       rel_date& operator+=(months m);
@@ -340,54 +352,31 @@
 
     inline rel_date operator/(year_month ym, nth_weekday d)
     {
- return rel_date(ym.get_year(), ym.get_month(), d);
+ return rel_date(year(ym), month(ym), d);
     }
     inline rel_date operator/(year_month ym, nth d)
     {
- return rel_date(ym.get_year(), ym.get_month(), d);
- }
- inline rel_date operator/(year_month ym, last_t)
- {
- return rel_date(ym.get_year(), ym.get_month(), nth(6));
+ return rel_date(year(ym), month(ym), d);
     }
- inline rel_date operator/(year_month ym, _1st_t)
- {
- return rel_date(ym.get_year(), ym.get_month(), nth(1));
- }
- inline rel_date operator/(year_month ym, _2nd_t)
- {
- return rel_date(ym.get_year(), ym.get_month(), nth(2));
- }
- inline rel_date operator/(year_month ym, _3rd_t)
- {
- return rel_date(ym.get_year(), ym.get_month(), nth(3));
- }
- inline rel_date operator/(year_month ym, _4th_t)
- {
- return rel_date(ym.get_year(), ym.get_month(), nth(4));
- }
- inline rel_date operator/(year_month ym, _5th_t)
- {
- return rel_date(ym.get_year(), ym.get_month(), nth(5));
- }
- inline rel_date operator/(month_nth_weekday md, year y)
+
+ inline rel_date operator/(month_nth_weekday md, chrono::year y)
     {
- return rel_date(y, md.get_month(), md.get_nth_weekday());
+ return rel_date(y, month(md), nth_weekday(md));
     }
 
     inline rel_date operator/(month_nth_weekday md, year::rep y)
     {
- return md / year(y);
+ return md / chrono::year(y);
     }
 
- inline rel_date operator/(month_nth md, year y)
+ inline rel_date operator/(month_nth md, chrono::year y)
     {
- return rel_date(y, md.get_month(), md.get_nth());
+ return rel_date(y, month(md), nth(md));
     }
 
     inline rel_date operator/(month_nth md, year::rep y)
     {
- return md / year(y);
+ return md / chrono::year(y);
     }
 
   } // chrono

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-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -9,7 +9,7 @@
 #ifndef BOOST_CHRONO_DATE_TUPLES_HPP
 #define BOOST_CHRONO_DATE_TUPLES_HPP
 
-#include <boost/chrono/config.hpp>
+#include <boost/chrono/date/config.hpp>
 #include <boost/chrono/date/no_check.hpp>
 #include <boost/chrono/date/year.hpp>
 #include <boost/chrono/date/month.hpp>
@@ -29,13 +29,15 @@
      * Class year_month is a tuple-like class of year-month.
      *
      * It is CopyConstructible, CopyAssignable, and Destructible.
+ *
+ * In addition to construction and getters it provides the number of days in this year/month.
      */
     class year_month
     {
       year y_;
       month m_;
     public:
- year_month(year y, month m) BOOST_NOEXCEPT
+ BOOST_CONSTEXPR year_month(year y, month m) BOOST_NOEXCEPT
       : y_(y),
       m_(m)
       {
@@ -48,7 +50,8 @@
       /**
        * @Return the year stored component.
        */
- year get_year() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
@@ -56,25 +59,27 @@
       /**
        * @Return the month stored component.
        */
- month get_month() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
 
+ // @todo make it possible to have BOOST_CONSTEXPR days_in
       /**
        * @Return the number of days of this month in this year.
        */
- days days_in() const BOOST_NOEXCEPT
+ chrono::days days_in() const BOOST_NOEXCEPT
       {
         return y_.days_in_month(m_);
       }
     };
 
- inline year_month operator/(year y, month m) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR year_month operator/(year y, month m) BOOST_NOEXCEPT
     {
       return year_month(y, m);
     }
- inline year_month operator/(month m, year y) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR year_month operator/(month m, year y) BOOST_NOEXCEPT
     {
       return year_month(y, m);
     }
@@ -89,7 +94,7 @@
       year y_;
       week w_;
     public:
- year_week(year y, week w) BOOST_NOEXCEPT
+ BOOST_CONSTEXPR year_week(year y, week w) BOOST_NOEXCEPT
       : y_(y),
       w_(w)
       {
@@ -103,26 +108,28 @@
       /**
        * @Return the year stored component.
        */
- year get_year() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
       /**
        * @Return the week stored component.
        */
- week get_week() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::week week() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
       {
         return w_;
       }
 
     };
 
- inline year_week operator/(year y, week w) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR year_week operator/(year y, week w) BOOST_NOEXCEPT
     {
       return year_week(y, w);
     }
 
- inline year_week operator/(week w, year y) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR year_week operator/(week w, year y) BOOST_NOEXCEPT
     {
       return year_week(y, w);
     }
@@ -140,7 +147,7 @@
       month m_;
       day d_;
     public:
- month_day(month m, day d)BOOST_NOEXCEPT
+ BOOST_CONSTEXPR month_day(month m, day d)BOOST_NOEXCEPT
       : m_(m),
       d_(d)
       {
@@ -154,26 +161,28 @@
       /**
        * @Return the month stored component.
        */
- month get_month() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
       /**
        * @Return the day stored component.
        */
- day get_day() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
       {
         return d_;
       }
     };
 
- inline month_day operator/(month m, day d) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR month_day operator/(month m, day d) BOOST_NOEXCEPT
     {
       return month_day(m, d);
     }
 
 
- inline month_day operator/(day d, month m) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR month_day operator/(day d, month m) BOOST_NOEXCEPT
     {
       return month_day(m, d);
     }
@@ -245,34 +254,36 @@
       week w_;
       weekday wd_;
     public:
- week_weekday(week w, weekday wd)BOOST_NOEXCEPT
+ 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_NOEXCEPT
+ week_weekday(week::rep w, weekday::rep wd, check_t)
       : w_(w, check),
       wd_(wd, check)
       {
       }
- week get_week() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::week week() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
       {
         return w_;
       }
- weekday get_weekday() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::weekday weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
       {
         return wd_;
       }
 
     };
 
- inline week_weekday operator/(week w, weekday wd) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR week_weekday operator/(week w, weekday wd) BOOST_NOEXCEPT
     {
       return week_weekday(w, wd);
     }
 
- inline week_weekday operator/(weekday wd, week w) BOOST_NOEXCEPT
+ inline BOOST_CONSTEXPR week_weekday operator/(weekday wd, week w) BOOST_NOEXCEPT
     {
       return week_weekday(w, wd);
     }
@@ -281,6 +292,7 @@
      * Class year_month_day is a tuple-like class of year-month-day.
      *
      * It is CopyConstructible, CopyAssignable, and Destructible.
+ * In addition to construction and getters it provides validation of the year-month-day tuple.
      */
     class year_month_day
     {
@@ -288,38 +300,46 @@
       month m_;
       day d_;
     public:
- year_month_day(year y, month m, day d)BOOST_NOEXCEPT
+ 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_NOEXCEPT
+ year_month_day(year::rep y, month::rep m, day::rep d, check_t)
       : y_(y, check),
       m_(m, check),
       d_(d, check)
       {
       }
- year get_year() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
- month get_month() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
- day get_day() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
       {
         return d_;
       }
-
+ BOOST_CONSTEXPR bool is_valid()
+ {
+ // @todo implement this function
+ return true;
+ }
     };
 
     /**
- * Class year_month_day is a tuple-like class of year-month-day.
+ * Class year_month_day is a tuple-like class of year-month-day-bool.
      *
      * It is CopyConstructible, CopyAssignable, and Destructible.
+ * In addition to construction and getters it provides validation of the year-month-day-bool tuple.
      */
     class year_month_day_leap
     {
@@ -328,7 +348,7 @@
       day d_;
       bool leap_;
     public:
- year_month_day_leap(year y, month m, day d, bool leap)BOOST_NOEXCEPT
+ BOOST_CONSTEXPR year_month_day_leap(year y, month m, day d, bool leap)BOOST_NOEXCEPT
       : y_(y),
       m_(m),
       d_(d),
@@ -336,60 +356,75 @@
       {
       }
 
- year_month_day_leap(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+ // @todo remove this overload
+ 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),
       leap_(leap)
       {
       }
- year get_year() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
- month get_month() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
         return m_;
       }
- day get_day() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
       {
         return d_;
       }
- bool is_leap_year() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
       {
         return leap_;
       }
-
+ BOOST_CONSTEXPR bool is_valid()
+ {
+ // @todo implement this function
+ return true;
+ }
     };
     /**
      * Class year_day_of_year is a tuple-like class of year-day_of_year.
      *
      * It is CopyConstructible, CopyAssignable, and Destructible.
+ * In addition to construction and getters it provides validation of the year-day_of_year tuple.
      */
     class year_day_of_year
     {
       year y_;
       day_of_year d_;
     public:
- year_day_of_year(year y, day_of_year d)BOOST_NOEXCEPT
+ 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_NOEXCEPT
+ year_day_of_year(year::rep y, day_of_year::rep d, check_t)
       : y_(y, check),
       d_(d, check)
       {
       }
- year get_year() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
- day_of_year get_day_of_year() const BOOST_NOEXCEPT
+ //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
       {
         return d_;
       }
-
+ BOOST_CONSTEXPR bool is_valid()
+ {
+ // @todo implement this function
+ return true;
+ }
     };
 
 
@@ -397,6 +432,8 @@
      * Class year_week_weekday is a tuple-like class of year-week-weekday.
      *
      * It is CopyConstructible, CopyAssignable, and Destructible.
+ * In addition to construction and getters it provides validation of the year-week-weekday tuple.
+ *
      */
     class year_week_weekday
     {
@@ -404,43 +441,42 @@
       week w_;
       weekday wd_;
     public:
- year_week_weekday(year y, week w, weekday wd)BOOST_NOEXCEPT
+ 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_NOEXCEPT
+ year_week_weekday(year::rep y, week::rep w, weekday::rep wd, check_t)
       : y_(y, check),
       w_(w, check),
       wd_(wd, check)
       {
       }
- year get_year() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
         return y_;
       }
- week get_week() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::week week() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::week() const BOOST_NOEXCEPT
       {
         return w_;
       }
- weekday get_weekday() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::weekday weekday() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
       {
         return wd_;
       }
-
+ BOOST_CONSTEXPR bool is_valid()
+ {
+ // @todo implement this function
+ return true;
+ }
     };
 
 
-
-
-
-
-
-
-
-
   } // chrono
 
 } // boost

Modified: sandbox/chrono_date/boost/chrono/date/week.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/week.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/week.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -25,7 +25,7 @@
     /**
      * The class week is used to specify the week of the year. Its range is [1,53].
      */
- typedef bounded<week_tag, 1, 53, int_least8_t> week;
+ typedef bounded<week_tag, 1, 53> week;
 
     /**
      * week pseudo-literals.

Modified: sandbox/chrono_date/boost/chrono/date/weekday.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/weekday.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/weekday.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -12,6 +12,7 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/chrono/date/detail/bounded.hpp>
+#include <boost/chrono/date/config.hpp>
 
 namespace boost
 {
@@ -25,9 +26,9 @@
     /**
      * The class weekday is used to specify a day of the week.
      */
- class weekday: public bounded<weekday_tag, 0, 6, int_least8_t>
+ class weekday: public bounded<weekday_tag, 0, 6>
     {
- typedef bounded<weekday_tag, 0, 6, int_least8_t> base_type;
+ typedef bounded<weekday_tag, 0, 6> base_type;
 
     public:
       BOOST_STATIC_CONSTEXPR rep not_applicable=7;
@@ -67,25 +68,16 @@
      * const weekday sat(6);
      *
      */
-#ifndef BOOST_NO_CXX11_CONSTEXPR
- BOOST_CONSTEXPR_OR_CONST weekday
- sun(0)
- , mon(1)
- , tue(2)
- , wed(3)
- , thu(4)
- , fri(5)
- , sat(6)
- ;
-#else
- extern const weekday sun;
- extern const weekday mon;
- extern const weekday tue;
- extern const weekday wed;
- extern const weekday thu;
- extern const weekday fri;
- extern const weekday sat;
-#endif
+
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(weekday, sun, 0);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(weekday, mon, 1);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(weekday, tue, 2);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(weekday, wed, 3);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(weekday, thu, 4);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(weekday, fri, 5);
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DCL(weekday, sat, 6);
+
+
     /**
      * Overload for string vonversion.
      * @param v the weekday

Modified: sandbox/chrono_date/boost/chrono/date/ydoy_date.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/ydoy_date.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/ydoy_date.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -49,402 +49,501 @@
       int_least16_t y_;
       uint_least16_t doy_ :9;
       uint_least8_t leap_ :1;
- uint_least8_t reserved2_ :6;
+ //uint_least8_t reserved2_ :6;
 
     public:
 
- /**
- * @Effect Constructs a ydoy_date using the year, month, day stored in the arguments as follows:
- * If the value stored in d is outside the range of valid dates for this month m and year y,
- * throws an exception of type bad_date.
- * Else constructs a ydoy_date for which get_year() == y, get_month() == m, get_day() == d.
- * @Throws bad_date if the specified ydoy_date is invalid.
- */
- ydoy_date(year y, month m, day d, check_t);
- /**
- * @Effect Constructs a ydoy_date constructor from year, month, day stored in the arguments as follows:
- * Constructs a ydoy_date so that get_year() == y, get_month() = m=, get_day() == d.
- */
- ydoy_date(year y, month m, day d)
-BOOST_NOEXCEPT ;
- /**
- * @Effect Constructs a ydoy_date using the year, month_day stored in the arguments as follows:
- * If the value stored in md is outside the range of valid dates for this year y,
- * throws an exception of type bad_date.
- * Else constructs a ydoy_date for which get_year() == y, get_month() == md.get_month(), get_day() == md.get_month().
- *
- * @Throws bad_date if the specified ydoy_date is invalid.
- * @Note This constructor can be more efficient as the month_day is already valid.
- */
- ydoy_date(year y, month_day md, check_t);
- /**
- * @Effect Constructs a ydoy_date using the year, month_day stored in the arguments as follows:
- * Constructs a ydoy_date for which get_year() == y, get_month() == md.get_month(), get_day() == md.get_month().
- * @Note This constructor can be more efficient as the month_day is already valid.
- */
- ydoy_date(year, month_day) BOOST_NOEXCEPT;
+// /**
+// * @Effect Constructs a ydoy_date using the year, month, day stored in the arguments as follows:
+// * If the value stored in d is outside the range of valid dates for this month m and year y,
+// * throws an exception of type bad_date.
+// * Else constructs a ydoy_date for which year() == y, month() == m, day() == d.
+// * @Throws bad_date if the specified ydoy_date is invalid.
+// */
+// ydoy_date(chrono::year y, chrono::month m, day d, check_t);
+// /**
+// * @Effect Constructs a ydoy_date constructor from year, month, day stored in the arguments as follows:
+// * Constructs a ydoy_date so that year() == y, month() = m=, day() == d.
+// */
+// ydoy_date(chrono::year y, chrono::month m, day d)
+//BOOST_NOEXCEPT ;
+// /**
+// * @Effect Constructs a ydoy_date using the year, month_day stored in the arguments as follows:
+// * If the value stored in md is outside the range of valid dates for this year y,
+// * throws an exception of type bad_date.
+// * Else constructs a ydoy_date for which year() == y, month() == md.month(), day() == md.month().
+// *
+// * @Throws bad_date if the specified ydoy_date is invalid.
+// * @Note This constructor can be more efficient as the month_day is already valid.
+// */
+// ydoy_date(chrono::year y, month_day md, check_t);
+// /**
+// * @Effect Constructs a ydoy_date using the year, month_day stored in the arguments as follows:
+// * Constructs a ydoy_date for which year() == y, month() == md.month(), day() == md.month().
+// * @Note This constructor can be more efficient as the month_day is already valid.
+// */
+// ydoy_date(chrono::year, month_day) BOOST_NOEXCEPT;
 
       /**
        * @Effect Constructs a ydoy_date using the year, day_of_year stored in the arguments as follows:
        * If the value stored in doy is 366 and the year.is_leap()
        * throws an exception of type bad_date.
- * Else constructs a ydoy_date for which days_since_epoch() == y.days_since_epoch()+doy.value()
+ * Else constructs a ydoy_date for which days_since_epoch() == y.days_since_epoch()+doy
        * @Throws bad_date if the specified ydoy_date is invalid.
        * @Note This constructor can be more efficient as the check is simple.
        */
- ydoy_date(year y, day_of_year doy, check_t);
+ ydoy_date(chrono::year y, day_of_year doy, check_t);
       /**
        * @Effect Constructs a ydoy_date using the year, day_of_year stored in the arguments as follows:
- * Constructs a ydoy_date for which days_since_epoch() == y.days_since_epoch()+doy.value()
+ * Constructs a ydoy_date for which days_since_epoch() == y.days_since_epoch()+doy
        * @Throws bad_date if the specified ydoy_date is invalid.
        */
- ydoy_date(year y, day_of_year m) BOOST_NOEXCEPT;
-
- /**
- * @Effect Constructs a ydoy_date using the days given as parameter so that:
- * days_since_epoch() == ds.count()
- */
- explicit ydoy_date(days, check_t);
- /**
- * Unchecked constructor from days.
- */
- ydoy_date(days m) BOOST_NOEXCEPT;
-
- /**
- * Unchecked constructor from ymd+leap
- */
- ydoy_date(days::rep, year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
- : y_(y),
- doy_(month_day_to_day_of_year(leap,m,d)),
- leap_(leap)
- {
-
- }
- /**
- * Unchecked constructor from ymd+leap
- */
- ydoy_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
- : y_(y),
- doy_(month_day_to_day_of_year(leap,m,d)),
- leap_(leap)
- {
- }
-
- /**
- * @Return A ydoy_date which represents the current day taking the local time zone into account.
- */
- static ydoy_date today() BOOST_NOEXCEPT;
+ BOOST_CHRONO_DATE_CONSTEXPR ydoy_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT
+ : y_(y),
+ doy_(doy),
+ leap_(is_leap(y_))
+ {
+ }
+// /**
+// * @Effect Constructs a ydoy_date using the days given as parameter so that:
+// * days_since_epoch() == ds.count()
+// */
+// explicit ydoy_date(days, check_t);
+// /**
+// * Unchecked constructor from days.
+// */
+// ydoy_date(days m) BOOST_NOEXCEPT;
+//
+// /**
+// * Unchecked constructor from ymd+leap
+// */
+// ydoy_date(days::rep, year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+// : y_(y),
+// doy_(month_day_to_day_of_year(leap,m,d)),
+// leap_(leap)
+// {
+//
+// }
+// /**
+// * Unchecked constructor from ymd+leap
+// */
+// ydoy_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+// : y_(y),
+// doy_(month_day_to_day_of_year(leap,m,d)),
+// leap_(leap)
+// {
+// }
+
+// /**
+// * @Return A ydoy_date which represents the current day taking the local time zone into account.
+// */
+// static ydoy_date today() BOOST_NOEXCEPT;
 
       /**
        * Effects: Constructs a ydoy_date as if by year(0)/jan/1.
        * Note: the purpose of this constructor is to have a very efficient means
        * of ydoy_date construction when the specific value for that ydoy_date is unimportant.
        */
- ydoy_date() BOOST_NOEXCEPT;
-
- /**
- * @Effects: tp is converted to UTC, and then trucated to 00:00:00 hours.
- * A ydoy_date is created which reflects this point in time.
- * @Throws If the conversion from tp overflows the range of ydoy_date, throws
- * an exception of type bad_date.
- *
- */
- explicit ydoy_date(system_clock::time_point tp);
- /**
- * @Returns: A system_clock::time_point which represents the ydoy_date
- * referred to by *this at 00:00:00 UTC.
- *
- * @Throws: If the conversion to tp overflows the range of
- * system_clock::time_point, throws an exception of type bad_date.
- *
- */
- // explicit
- operator system_clock::time_point () const;
+ BOOST_CONSTEXPR ydoy_date() BOOST_NOEXCEPT
+ :
+ y_(0),
+ doy_(1),
+ leap_(1)
+ {
+ }
+
+
+// /**
+// * @Effects: tp is converted to UTC, and then trucated to 00:00:00 hours.
+// * A ydoy_date is created which reflects this point in time.
+// * @Throws If the conversion from tp overflows the range of ydoy_date, throws
+// * an exception of type bad_date.
+// *
+// */
+// explicit ydoy_date(system_clock::time_point tp);
+// /**
+// * @Returns: A system_clock::time_point which represents the ydoy_date
+// * referred to by *this at 00:00:00 UTC.
+// *
+// * @Throws: If the conversion to tp overflows the range of
+// * system_clock::time_point, throws an exception of type bad_date.
+// *
+// */
+// // explicit
+// operator system_clock::time_point () const;
 
- bool is_valid() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
       {
- return year(y_).is_valid() && day_of_year(doy_).is_valid();
+ // @todo add check on valid day_of_year and leap year.
+ return chrono::year(y_).is_valid() && day_of_year(doy_).is_valid();
       }
 
       /**
        * @Returns: the number of days since an undefined epoch.
        */
- days days_since_epoch() const
+ days to_days_since_epoch() const
       {
         return days(days_before_year(y_+32799)+doy_-1);
       }
-
- ydoy_date(ymd_date dt);
- operator ymd_date() const
- {
- return days_date(year(y_), day_of_year(doy_));
- }
-
- ydoy_date(days_date dt);
- operator days_date() const
- {
- return days_date(year(y_), day_of_year(doy_));
- }
-
- /**
- * @Returns: day(d_).
- */
- day get_day() const BOOST_NOEXCEPT
- {
- return day(day_of_year_day_of_month(leap_,doy_));
- }
- /**
- * @Returns: month(m_).
- */
- month get_month() const BOOST_NOEXCEPT
- {
- return month(day_of_year_month(leap_,doy_));
- }
- /**
- * @Returns: year(y_).
- */
- year get_year() const BOOST_NOEXCEPT
- {
- return year(y_);
- }
- month_day get_month_day() const BOOST_NOEXCEPT
- {
- return month_day(month(day_of_year_month(leap_,doy_)), day(day_of_year_day_of_month(leap_,doy_)));
- }
- year_month get_year_month() const BOOST_NOEXCEPT
- {
- return year_month(year(y_),month(day_of_year_month(leap_,doy_)));
- }
- year_month_day get_year_month_day() const BOOST_NOEXCEPT
- {
- return to_ymd(year_day_of_year(year(y_),day_of_year(doy_)));
- }
- /**
- * @Returns: true if year() is a leap year, and otherwise returns false.
- */
- bool is_leap_year() const BOOST_NOEXCEPT
- {
- return leap_;
- }
-
       /**
- * @Returns: A weekday constructed with an int corresponding to *this
- * ydoy_date's day of the week (a value in the range of [0 - 6], 0 is Sunday).
+ * @Returns: the number of days since an undefined epoch.
        */
- weekday get_weekday() const BOOST_NOEXCEPT
+ days days_since_epoch() const
       {
- return weekday((days_since_epoch()+days(1)).count() % weekday::size);
+ return days(days_before_year(y_+32799)+doy_-1);
       }
 
       /**
- * @Effects: Adds d.count() days to the current ydoy_date.
- * @Returns: *this.
- * @Throws: If the addition would create a ydoy_date with a y_ outside of the
- * range of year, throws an exception of type bad_date.
+ * Explicit conversion from @c ymd_date.
        *
+ * @Effects stores a year and days_of_year that represents the same date as the @c dt @c days_date parameter.
        */
- ydoy_date& operator+=(days d);
-
- /**
- * @Effects: *this += days(1).
- * @Returns: *this.
- */
- ydoy_date& operator++()
- {
- return *this += days(1);
- }
+ explicit ydoy_date(days_date dt);
+//#if ! defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
       /**
- * @Effects: *this += days(1).
- * @Returns: A copy of *this prior to the increment.
- */
- ydoy_date operator++(int)
- {
- ydoy_date tmp(*this);
- ++(*this);
- return tmp;
- }
- /**
- * @Effects: *this += -d.
- * @Returns: *this.
- */
- ydoy_date& operator-=(days d)
- {
- return *this += -d;
- }
- /**
- * @Effects: *this -= days(1).
- * @Returns: *this.
+ * Explicit conversion to @c days_date.
+ *
+ * @Returns a @c days_date representing the same date.
        */
- ydoy_date& operator--()
+ //BOOST_CHRONO_EXPLICT
+ operator days_date() const
       {
- return *this -= days(1);
+ year::rep by = y_ + 32799;
+ return days_date(days(days_before_year(by) + doy_ - 1));
+ //return days_date(chrono::year(y_), day_of_year(doy_));
       }
+//#endif
       /**
- * @Effects: *this -= days(1).
- * @Returns: A copy of *this prior to the increment.
+ * Explicit conversion to @c days_date.
+ *
+ * @Returns a @c days_date representing the same date.
        */
- ydoy_date operator--(int)
+ friend days_date to_days_date(ydoy_date ydoy)
       {
- ydoy_date tmp(*this); --(*this); return tmp;
+ year::rep by = ydoy.y_ + 32799;
+ return days_date(days(days_before_year(by) + ydoy.doy_ - 1));
+ //return days_date(chrono::year(y_), day_of_year(doy_));
       }
 
       /**
- * @Returns: dt += d.
+ * Explicit conversion from @c ymd_date.
        *
+ * @Effects stores a year and days_of_year that represents the same date as the @c dt @c ymd_date parameter.
        */
- friend ydoy_date operator+(ydoy_date dt, days d)
- {
- dt += d;
- return dt;
- }
+ explicit ydoy_date(ymd_date dt);
+#if ! defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
       /**
- * @Returns: dt += d.
+ * Explicit conversion to @c ymd_date.
        *
+ * @Returns a @c ymd_date representing the same date.
        */
- friend ydoy_date operator+(days d, ydoy_date dt)
+ BOOST_CHRONO_EXPLICT operator ymd_date() const
       {
- dt += d;
- return dt;
+ //return days_date(chrono::year(y_), day_of_year(doy_));
+ return ymd_date(to_days_date(*this));
       }
+#endif
       /**
- * @Returns: dt -= d.
+ * Explicit conversion to @c ymd_date.
        *
+ * @Returns a @c ymd_date representing the same date.
        */
- friend ydoy_date operator-(ydoy_date dt, days d)
+ friend ymd_date to_ymd_date(ydoy_date ydoy)
       {
- dt -= d;
- return dt;
- }
- /**
- * @Returns: Computes the number of days x is ahead of y in the calendar,
- * and returns that signed integral number n as days(n).
- */
- friend days operator-(ydoy_date x, ydoy_date y) BOOST_NOEXCEPT
- {
- return days(x.days_since_epoch() - y.days_since_epoch());
+ return ymd_date(to_days_date(ydoy));
       }
 
- friend days operator-(ymd_date x, ydoy_date y) BOOST_NOEXCEPT
- {
- return days(x.days_since_epoch() - y.days_since_epoch());
- }
 
- friend days operator-(ydoy_date x, ymd_date y) BOOST_NOEXCEPT
- {
- return days(x.days_since_epoch() - y.days_since_epoch());
- }
 
       /**
- * @Effects Adds m.count() months to the current ydoy_date.
- * This is accomplished as if by storing temporary values of the ydoy_date's y_, doy_.
- * Computing new values for y_ and doy_ based on m. And then assigning to
- * *this a new ydoy_date constructed from the newly computed y_ and doy_.
- *
- * @Returns: *this.
- *
- * @Throws: If the addition would create a ydoy_date with a y_ outside of the
- * range of year, or a doy_ outside the range for the newly computed y_,
- * throws an exception of type bad_date.
- *
+ * @Returns: chrono::day(d_).
        */
- ydoy_date& operator+=(months m);
-
+// chrono::day to_day() const BOOST_NOEXCEPT
+// {
+// return chrono::day(day_of_year_day_of_month(leap_,doy_));
+// }
+// /**
+// * @Returns: chrono::day(d_).
+// */
+// chrono::day day() const BOOST_NOEXCEPT
+// {
+// return chrono::day(day_of_year_day_of_month(leap_,doy_));
+// }
       /**
- * @Returns: *this += -m.
+ * @Returns: chrono::month(m_).
        */
- ydoy_date& operator-=(months m)
+ chrono::month to_month() const BOOST_NOEXCEPT
       {
- return *this += months(-m.count());
+ return chrono::month(day_of_year_month(leap_,doy_));
       }
-
+// /**
+// * @Returns: chrono::month(m_).
+// */
+// chrono::month month() const BOOST_NOEXCEPT
+// {
+// return chrono::month(day_of_year_month(leap_,doy_));
+// }
       /**
- * @Returns: dt += m.
- *
+ * @Returns: chrono::year(y_).
        */
- friend ydoy_date operator+(ydoy_date dt, months m)
+ BOOST_CONSTEXPR chrono::year to_year() const BOOST_NOEXCEPT
       {
- dt += m;
- return dt;
+ return chrono::year(y_);
       }
       /**
- * @Returns: dt += m.
- *
+ * @Returns: chrono::year(y_).
        */
- friend ydoy_date operator+(months m, ydoy_date dt)
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
- dt += m;
- return dt;
+ return chrono::year(y_);
       }
- /**
- * @Returns: dt += -m.
- *
- */
- friend ydoy_date operator-(ydoy_date dt, months m)
+ chrono::month_day month_day() const BOOST_NOEXCEPT
       {
- dt -= m;
- return dt;
+ return chrono::month_day(chrono::month(day_of_year_month(leap_,doy_)), chrono::day(day_of_year_day_of_month(leap_,doy_)));
       }
-
- /**
- * @Effects: Adds y.count() years to the current ydoy_date.
- * This is accomplished as if by storing temporary values of the ydoy_date's
- * y_, doy_. Computing a new value for y_. And then assigning to *this
- * a new ydoy_date constructed from the newly computed y_, and the original doy_.
- * @Returns: *this.
- * @Throws: If the addition would create a ydoy_date with a y_ outside of the
- * range of year, or a doy_ outside the range for the newly computed y_,
- * throws an exception of type bad_date.
- */
- ydoy_date& operator+=(years y);
-
- /**
- * @Returns: *this += -y.
- *
- */
- ydoy_date& operator-=(years y)
+ chrono::year_month year_month() const BOOST_NOEXCEPT
       {
- return *this += years(-y.count());
+ return chrono::year_month(chrono::year(y_),chrono::month(day_of_year_month(leap_,doy_)));
+ }
+ chrono::year_month_day year_month_day() const BOOST_NOEXCEPT
+ {
+ return to_ymd(chrono::year_day_of_year(chrono::year(y_),day_of_year(doy_)));
       }
-
       /**
- * @Returns: dt += y.
- *
+ * @Returns: true if year() is a leap year, and otherwise returns false.
        */
- friend ydoy_date operator+(ydoy_date dt, years y)
+ BOOST_CONSTEXPR bool to_is_leap_year() const BOOST_NOEXCEPT
       {
- dt += y;
- return dt;
+ return leap_;
       }
       /**
- * @Returns: dt += y.
- *
+ * @Returns: true if year() is a leap year, and otherwise returns false.
        */
- friend ydoy_date operator+(years y, ydoy_date dt)
+ BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
       {
- dt += y;
- return dt;
+ return leap_;
       }
+
       /**
- * @Returns: dt -= y.
- *
+ * @Returns: A weekday constructed with an int corresponding to *this
+ * ydoy_date's day of the week (a value in the range of [0 - 6], 0 is Sunday).
        */
- friend ydoy_date operator-(ydoy_date dt, years y)
+ chrono::weekday to_weekday() const BOOST_NOEXCEPT
       {
- dt -= y;
- return dt;
+ return chrono::weekday((days_since_epoch()+days(1)).count() % chrono::weekday::size);
       }
 
+
+// /**
+// * @Effects: Adds d.count() days to the current ydoy_date.
+// * @Returns: *this.
+// * @Throws: If the addition would create a ydoy_date with a y_ outside of the
+// * range of year, throws an exception of type bad_date.
+// *
+// */
+// ydoy_date& operator+=(days d);
+//
+// /**
+// * @Effects: *this += days(1).
+// * @Returns: *this.
+// */
+// ydoy_date& operator++()
+// {
+// return *this += days(1);
+// }
+// /**
+// * @Effects: *this += days(1).
+// * @Returns: A copy of *this prior to the increment.
+// */
+// ydoy_date operator++(int)
+// {
+// ydoy_date tmp(*this);
+// ++(*this);
+// return tmp;
+// }
+// /**
+// * @Effects: *this += -d.
+// * @Returns: *this.
+// */
+// ydoy_date& operator-=(days d)
+// {
+// return *this += -d;
+// }
+// /**
+// * @Effects: *this -= days(1).
+// * @Returns: *this.
+// */
+// ydoy_date& operator--()
+// {
+// return *this -= days(1);
+// }
+// /**
+// * @Effects: *this -= days(1).
+// * @Returns: A copy of *this prior to the increment.
+// */
+// ydoy_date operator--(int)
+// {
+// ydoy_date tmp(*this); --(*this); return tmp;
+// }
+//
+// /**
+// * @Returns: dt += d.
+// *
+// */
+// friend ydoy_date operator+(ydoy_date dt, days d)
+// {
+// dt += d;
+// return dt;
+// }
+// /**
+// * @Returns: dt += d.
+// *
+// */
+// friend ydoy_date operator+(days d, ydoy_date dt)
+// {
+// dt += d;
+// return dt;
+// }
+// /**
+// * @Returns: dt -= d.
+// *
+// */
+// friend ydoy_date operator-(ydoy_date dt, days d)
+// {
+// dt -= d;
+// return dt;
+// }
+// /**
+// * @Returns: Computes the number of days x is ahead of y in the calendar,
+// * and returns that signed integral number n as days(n).
+// */
+// friend days operator-(ydoy_date x, ydoy_date y) BOOST_NOEXCEPT
+// {
+// return days(x.days_since_epoch() - y.days_since_epoch());
+// }
+//
+// friend days operator-(ymd_date x, ydoy_date y) BOOST_NOEXCEPT
+// {
+// return days(x.days_since_epoch() - y.days_since_epoch());
+// }
+//
+// friend days operator-(ydoy_date x, ymd_date y) BOOST_NOEXCEPT
+// {
+// return days(x.days_since_epoch() - y.days_since_epoch());
+// }
+
+// /**
+// * @Effects Adds m.count() months to the current ydoy_date.
+// * This is accomplished as if by storing temporary values of the ydoy_date's y_, doy_.
+// * Computing new values for y_ and doy_ based on m. And then assigning to
+// * *this a new ydoy_date constructed from the newly computed y_ and doy_.
+// *
+// * @Returns: *this.
+// *
+// * @Throws: If the addition would create a ydoy_date with a y_ outside of the
+// * range of year, or a doy_ outside the range for the newly computed y_,
+// * throws an exception of type bad_date.
+// *
+// */
+// ydoy_date& operator+=(months m);
+//
+// /**
+// * @Returns: *this += -m.
+// */
+// ydoy_date& operator-=(months m)
+// {
+// return *this += months(-m.count());
+// }
+//
+// /**
+// * @Returns: dt += m.
+// *
+// */
+// friend ydoy_date operator+(ydoy_date dt, months m)
+// {
+// dt += m;
+// return dt;
+// }
+// /**
+// * @Returns: dt += m.
+// *
+// */
+// friend ydoy_date operator+(months m, ydoy_date dt)
+// {
+// dt += m;
+// return dt;
+// }
+// /**
+// * @Returns: dt += -m.
+// *
+// */
+// friend ydoy_date operator-(ydoy_date dt, months m)
+// {
+// dt -= m;
+// return dt;
+// }
+//
+// /**
+// * @Effects: Adds y.count() years to the current ydoy_date.
+// * This is accomplished as if by storing temporary values of the ydoy_date's
+// * y_, doy_. Computing a new value for y_. And then assigning to *this
+// * a new ydoy_date constructed from the newly computed y_, and the original doy_.
+// * @Returns: *this.
+// * @Throws: If the addition would create a ydoy_date with a y_ outside of the
+// * range of year, or a doy_ outside the range for the newly computed y_,
+// * throws an exception of type bad_date.
+// */
+// ydoy_date& operator+=(years y);
+//
+// /**
+// * @Returns: *this += -y.
+// *
+// */
+// ydoy_date& operator-=(years y)
+// {
+// return *this += years(-y.count());
+// }
+//
+// /**
+// * @Returns: dt += y.
+// *
+// */
+// friend ydoy_date operator+(ydoy_date dt, years y)
+// {
+// dt += y;
+// return dt;
+// }
+// /**
+// * @Returns: dt += y.
+// *
+// */
+// friend ydoy_date operator+(years y, ydoy_date dt)
+// {
+// dt += y;
+// return dt;
+// }
+// /**
+// * @Returns: dt -= y.
+// *
+// */
+// friend ydoy_date operator-(ydoy_date dt, years y)
+// {
+// dt -= y;
+// return dt;
+// }
+
       /**
        * @Returns: x.days_since_epoch() == y.days_since_epoch()
        */
- friend bool operator==(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator==(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
       {
         return x.y_ == y.y_ && x.doy_ == y.doy_;
       }
       /**
        * @Returns: x.days_since_epoch() < y.days_since_epoch()
        */
- friend bool operator< (const ydoy_date& x, const ydoy_date& y)
+ friend BOOST_CONSTEXPR bool operator< (const ydoy_date& x, const ydoy_date& y)
       {
         return x.y_ < y.y_ ||
         (!(y.y_ < x.y_) && (x.doy_ < y.doy_));
@@ -452,40 +551,43 @@
       /**
        * @Returns: !(x == y).
        */
- friend bool operator!=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator!=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
       {
         return !(x == y);
       }
       /**
        * @Returns: y < x.
        */
- friend bool operator> (const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator> (const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
       {
         return y < x;
       }
       /**
        * @Returns: !(y < x).
        */
- friend bool operator<=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator<=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
       {
         return !(y < x);
       }
       /**
        * @Returns: !(x < y).
        */
- friend bool operator>=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator>=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
       {
         return !(x < y);
       }
 
- /**
- * @Effects Update the ydoy_date if the parameters represents a valid ydoy_date.
- * @Returns true if the parameters represents a valid ydoy_date.
- */
- bool set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT;
+// /**
+// * @Effects Update the ydoy_date if the parameters represents a valid ydoy_date.
+// * @Returns true if the parameters represents a valid ydoy_date.
+// */
+// bool set_if_valid_date(chrono::year y, chrono::month m, chrono::day d) BOOST_NOEXCEPT;
 
     };
 
+ /**
+ * Partial specialization of @c is_date<days_date> as @c true_type.
+ */
     template <>
     struct is_date<ydoy_date> : true_type {};
 
@@ -499,21 +601,37 @@
 // */
 // optional_ydoy_date make_valid_ydoy_date(year,month,day) BOOST_NOEXCEPT;
 
- inline ydoy_date operator/(year y, day_of_year d)
+ /**
+ * @c ydoy_date factory.
+ * @Returns @c ydoy_date(y,d)
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(chrono::year y, day_of_year d)
     {
       return ydoy_date(y, d);
     }
- inline ydoy_date operator/(day_of_year d, year y)
+ /**
+ * @c ydoy_date factory.
+ * @Returns @c ydoy_date(y,d)
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(day_of_year d, chrono::year y)
     {
       return ydoy_date(y, d);
     }
- inline ydoy_date operator/(year y, day_of_year::rep d)
+ /**
+ * @c ydoy_date factory.
+ * @Returns @c y/day_of_year(d)
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(chrono::year y, int d)
     {
       return y / day_of_year(d);
     }
- inline ydoy_date operator/(day_of_year d, year::rep y)
+ /**
+ * @c ydoy_date factory.
+ * @Returns @c d/chrono::year(y)
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(day_of_year d, int y)
     {
- return d / year(y);
+ return d / chrono::year(y);
     }
 
   } // chrono

Modified: sandbox/chrono_date/boost/chrono/date/year.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/year.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/year.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -11,6 +11,7 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/chrono/date/detail/bounded.hpp>
+#include <boost/chrono/date/no_check.hpp>
 #include <boost/chrono/date/month.hpp>
 #include <boost/chrono/date/date_durations.hpp>
 #include <boost/chrono/date/detail/helpers.hpp>
@@ -33,18 +34,19 @@
      *
      * That range shall be at least [year(-32767)/jan/1 thru year(32767)/dec/31]. Its range is [-32768, 32767].
      */
- class year: public bounded<year_tag, -32768, 32767, int_least32_t>
+ class year: public bounded<year_tag, -32768, 32767, year_rep>
     {
- typedef bounded<year_tag, -32768, 32767, int_least32_t> base_type;
+ typedef bounded<year_tag, -32768, 32767, year_rep> base_type;
     public:
       /**
        * @Effects: Constructs an object of class year by storing y.
        * @Postconditions: static_cast<int>(*this) == y.
        */
       BOOST_CONSTEXPR explicit year(int v) :
- base_type(v),
- is_leap_(false),
- is_leap_initialized_(false)
+ base_type(v)
+
+ //is_leap_(false),
+ //is_leap_initialized_(false)
       {
       }
 
@@ -53,16 +55,16 @@
        * @Postconditions: static_cast<int>(*this) == y.
        * @Throws: if y is outside of the supported range, throws an exception of type bad_date.
        */
- BOOST_CONSTEXPR year(int y, check_t) BOOST_NOEXCEPT
- : base_type(y, check),
- is_leap_(false),
- is_leap_initialized_(false)
+ year(int y, check_t) BOOST_NOEXCEPT
+ : base_type(y, check)
+ //is_leap_(false),
+ //is_leap_initialized_(false)
       {}
 
       /**
        * @Return the number of days of this year.
        */
- days days_in() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR days days_in() const BOOST_NOEXCEPT
       {
         return days(365+days::rep(is_leap()));
       }
@@ -86,15 +88,16 @@
       /**
        * @Return whether this year is leap or not.
        */
- bool is_leap() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR bool is_leap() const BOOST_NOEXCEPT
       {
- if ( ! is_leap_initialized_)
- {
- int32_t y = value();
- is_leap_ = y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
- is_leap_initialized_ = true;
- }
- return is_leap_;
+ return chrono::is_leap(value());
+// if ( ! is_leap_initialized_)
+// {
+// int32_t y = value();
+// is_leap_ = y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
+// is_leap_initialized_ = true;
+// }
+// return is_leap_;
       }
 
       static BOOST_CONSTEXPR year zero() BOOST_NOEXCEPT
@@ -102,8 +105,8 @@
         return year(0);
       }
     private:
- mutable bool is_leap_;
- mutable bool is_leap_initialized_;
+ // mutable bool is_leap_;
+ // mutable bool is_leap_initialized_;
     };
 
   } // chrono

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-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -9,6 +9,8 @@
 #ifndef BOOST_CHRONO_DATE_YMD_DATE_HPP
 #define BOOST_CHRONO_DATE_YMD_DATE_HPP
 
+#define BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+
 #include <boost/cstdint.hpp>
 #include <boost/chrono/system_clocks.hpp>
 #include <boost/chrono/date/date_durations.hpp>
@@ -37,143 +39,276 @@
      * - the @c year,
      * - the @c month,
      * - the @c day of the month
- * and optionally
- * - the number of @c days since an undetermined epoch.
      * - whether the year is leap or not.
+ *
+ * Provides month and year arithmetic, but not day arithmetic (see @c days_date).
+ * Provides @c day, @c month, @c year, @c is_leap_year accessors, but tot @c weekday (see @c days_date).
      */
     class ymd_date
     {
 
-#if !defined BOOST_CHRONO_DATE_COMPACT
- // Store x, y/m/d, leap. Total 64 bits
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- uint_least32_t x_;
-#endif
- int_least16_t y_;
-
- uint_least8_t m_ :4;
- uint_least8_t reserved1_ :4;
-
- uint_least8_t d_ :5;
- uint_least8_t leap_ :1;
- uint_least8_t reserved2_ :2;
+// // Store x, y/m/d, leap. Total 64 bits
+// int_least16_t y_;
+//
+// uint_least8_t m_ ; //:4;
+// //int_least16_t reserved1_ :4;
+//
+// uint_least8_t d_ :5;
+// uint_least8_t leap_ :1;
+// //uint_least8_t reserved2_ :2;
+
+// int_least16_t y_;
+// uint_least8_t m_ ; //:4;
+// uint_least8_t d_ ;
+// bool leap_ ;
+
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+#if defined __clang__
+ int_least32_t y_;
+ int_least16_t m_;
+ int_least16_t d_;
 #else
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- days x_;
+ int_least16_t y_;
+ int_least8_t m_;
+ int_least8_t d_;
 #endif
- year y_;
- month m_;
- day d_;
- bool leap_;
+ bool leap_ ;
+#else
+ int_least32_t y_;
+ int_least16_t m_;
+ int_least16_t d_;
 #endif
+
     public:
+#if ! defined BOOST_CHRONO_DATE_DOXYGEN_INVOKED
+ private:
+ // emulates forwarding constructors
+ void ymd_date_c(chrono::year::rep y, chrono::month::rep m, chrono::day::rep d, check_t);
+#endif
       /**
        * @Effect Constructs a @c ymd_date using the @c year, @c month, @c day stored in the arguments as follows:
        * If the value stored in @c d is outside the range of valid dates for this month @c m and year @c y,
        * throws an exception of type @c bad_date.
- * Else constructs a @c ymd_date for which <c>get_year() == y && get_month() == m && get_day() == d</c>.
+ * Else constructs a @c ymd_date for which <c>year() == y && month() == m && day() == d</c>.
        * @Throws @c bad_date if the specified @c ymd_date is invalid.
        */
- ymd_date(year y, month m, day d, check_t);
+ public:
+ ymd_date(chrono::year y, chrono::month m, chrono::day d, check_t)
+ {
+ ymd_date_c(y,m,d, check);
+ }
+ ymd_date(int y, chrono::month m, chrono::day d, check_t)
+ {
+ ymd_date_c(y,m,d, check);
+ }
+ ymd_date(chrono::year y, int m, chrono::day d, check_t)
+ {
+ ymd_date_c(y,m,d, check);
+ }
+ ymd_date(chrono::year y, chrono::month m, int d, check_t)
+ {
+ ymd_date_c(y,m,d, check);
+ }
+
+#if ! defined BOOST_CHRONO_DATE_DOXYGEN_INVOKED
+ private:
+ // emulates forwarding constructors
+ void ymd_date_c(chrono::year::rep y, chrono::month::rep m, chrono::day::rep d) BOOST_NOEXCEPT;
+#endif
       /**
        * @Effect Constructs a @c ymd_date constructor from @c year, @c month, @c day stored in the arguments as follows:
- * Constructs a ymd_date so that <c>get_year() == y && get_month() = m && get_day() == d</c>.
+ * Constructs a ymd_date so that <c>year() == y && month() = m && day() == d</c>.
        */
- ymd_date(year y, month m, day d) BOOST_NOEXCEPT;
+ public:
+
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, chrono::day d) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int y, chrono::month m, chrono::day d) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, int m, chrono::day d) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, int d) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, chrono::day d, chrono::year y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, chrono::day d, int y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, int d, chrono::year y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int m, chrono::day d, chrono::year y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, chrono::month m, chrono::year y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, chrono::month m, int y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, int m, chrono::year y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int d, chrono::month m, chrono::year y) BOOST_NOEXCEPT :
+ y_(y),
+ m_(m),
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
+ {
+ }
       /**
        * @Effect Constructs a ymd_date using the year, month_day stored in the arguments as follows:
        * If the value stored in md is outside the range of valid dates for this year y,
        * throws an exception of type bad_date.
- * Else constructs a ymd_date for which get_year() == y, get_month() == md.get_month(), get_day() == md.get_month().
+ * Else constructs a ymd_date for which year(*this) == y, month(*this) == month(md), day(*this) == day(md).
        *
        * @Throws bad_date if the specified ymd_date is invalid.
        * @Note This constructor can be more efficient as the month_day is already valid.
        */
- ymd_date(year y, month_day md, check_t);
+ ymd_date(chrono::year y, month_day md, check_t);
       /**
        * @Effect Constructs a ymd_date using the year, month_day stored in the arguments as follows:
- * Constructs a ymd_date for which get_year() == y, get_month() == md.get_month(), get_day() == md.get_month().
+ * Constructs a ymd_date for which year() == y, month() == month(md), day() == month(md).
        * @Note This constructor can be more efficient as the month_day is already valid.
        */
- ymd_date(year, month_day) BOOST_NOEXCEPT;
-
- /**
- * @Effect Constructs a ymd_date using the year, day_of_year stored in the arguments as follows:
- * If the value stored in doy is 366 and the year.is_leap()
- * throws an exception of type bad_date.
- * Else constructs a ymd_date for which days_since_epoch() == y.days_since_epoch()+doy.value()
- * @Throws bad_date if the specified ymd_date is invalid.
- * @Note This constructor can be more efficient as the check is simple.
- */
- ymd_date(year y, day_of_year doy, check_t);
- /**
- * @Effect Constructs a ymd_date using the year, day_of_year stored in the arguments as follows:
- * Constructs a ymd_date for which days_since_epoch() == y.days_since_epoch()+doy.value()
- * @Throws bad_date if the specified ymd_date is invalid.
- */
- ymd_date(year y, day_of_year m) BOOST_NOEXCEPT;
-
- /**
- * @Effect Constructs a ymd_date using the days given as parameter so that:
- * days_since_epoch() == ds.count()
- */
- explicit ymd_date(days, check_t);
- /**
- * Unchecked constructor from days.
- */
- ymd_date(days m) BOOST_NOEXCEPT;
+ ymd_date(chrono::year, month_day) BOOST_NOEXCEPT;
 
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- /**
- * Unchecked constructor from days+ymd+leap
- */
- ymd_date(days::rep x, year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
- : x_(x),
- y_(y),
- m_(m),
- d_(d),
- leap_(leap)
- {
- }
- /**
- * Unchecked constructor from ymd+leap
- */
- ymd_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT;
+// /**
+// * @Effect Constructs a ymd_date using the year, day_of_year stored in the arguments as follows:
+// * If the value stored in doy is 366 and the year.is_leap()
+// * throws an exception of type bad_date.
+// * Else constructs a ymd_date for which days_since_epoch() == y.days_since_epoch()+doy
+// * @Throws bad_date if the specified ymd_date is invalid.
+// * @Note This constructor can be more efficient as the check is simple.
+// */
+// ymd_date(chrono::year y, day_of_year doy, check_t);
+// /**
+// * @Effect Constructs a ymd_date using the year, day_of_year stored in the arguments as follows:
+// * Constructs a ymd_date for which days_since_epoch() == y.days_since_epoch()+doy
+// * @Throws bad_date if the specified ymd_date is invalid.
+// */
+// ymd_date(chrono::year y, day_of_year m) BOOST_NOEXCEPT;
+
+// /**
+// * @Effect Constructs a ymd_date using the days given as parameter so that:
+// * days_since_epoch() == ds.count()
+// */
+// explicit ymd_date(days, check_t);
+// /**
+// * Unchecked constructor from days.
+// */
+// ymd_date(days m) BOOST_NOEXCEPT;
 
-#elif BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 3
       /**
        * Unchecked constructor from days+ymd+leap
        */
- ymd_date(days::rep, year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(days::rep, year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
       :
       y_(y),
       m_(m),
- d_(d),
- leap_(leap)
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(leap)
+#endif
       {
       }
       /**
        * Unchecked constructor from ymd+leap
        */
- ymd_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+ BOOST_CHRONO_DATE_CONSTEXPR ymd_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
       : y_(y),
       m_(m),
- d_(d),
- leap_(leap)
+ d_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(leap)
+#endif
       {
       }
-#endif
 
       /**
        * @Effects Update the ymd_date if the parameters represents a valid ymd_date.
        * @Returns true if the parameters represents a valid ymd_date.
        */
- bool set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT;
+ bool set_if_valid_date(chrono::year y, chrono::month m, day d) BOOST_NOEXCEPT;
       /**
        * @Effects Update the ymd_date if the parameters represents a valid ymd_date.
        * @Returns true if the parameters represents a valid ymd_date.
        */
- bool set_if_valid_date(year y, day_of_year doy) BOOST_NOEXCEPT;
+ bool set_if_valid_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT;
 
       /**
        * @Effects Update the ymd_date if the parameters represents a valid ymd_date.
@@ -191,15 +326,14 @@
        * Note: the purpose of this constructor is to have a very efficient means
        * of ymd_date construction when the specific value for that ymd_date is unimportant.
        */
- ymd_date() BOOST_NOEXCEPT
+ BOOST_CONSTEXPR ymd_date() BOOST_NOEXCEPT
       :
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- x_(11979588),
-#endif
       y_(0),
       m_(1),
- d_(1),
- leap_(1)
+ d_(1)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(true)
+#endif
       {
       }
       /**
@@ -217,186 +351,241 @@
        * @Throws: If the conversion to tp overflows the range of
        * system_clock::time_point, throws an exception of type bad_date.
        *
+ * @Notes Provided only of explicit conversion is supported (See @c to_date_clock_time_point()).
        */
- // explicit
- operator system_clock::time_point () const;
-
- bool is_valid() const BOOST_NOEXCEPT;
+ BOOST_CHRONO_EXPLICT operator system_clock::time_point () const;
+// /**
+// * @Returns: A system_clock::time_point which represents the ymd_date
+// * referred to by *this at 00:00:00 UTC.
+// *
+// * @Throws: If the conversion to tp overflows the range of
+// * system_clock::time_point, throws an exception of type bad_date.
+// *
+// */
+// system_clock::time_point to_date_clock_time_point() const { return system_clock::time_point(*this); }
 
       /**
- * @Returns: the number of days since an undefined epoch.
+ *
+ * @Returns whether the year()/month()/day() is a valid proleptic Gregorian date.
        */
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- days days_since_epoch() const
- {
- return days(x_);
- }
-#elif BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 3
- days days_since_epoch() const
- {
- return days(day_number_from_ymd());
- }
-#endif
+ // @todo BOOST_CONSTEXPR
+ bool is_valid() const BOOST_NOEXCEPT;
 
- ymd_date(days_date dt);
- operator days_date() const
- {
- return days_date(days_since_epoch());
- }
+//#if ! defined BOOST_CHRONO_DATE_DOXYGEN_INVOKED
+// private:
+// /*
+// * @Returns: the number of days since an undefined epoch.
+// */
+// days days_since_epoch() const
+// {
+// return days(day_number_from_ymd());
+// }
+//#endif
+// private:
+// /*
+// * @Returns: the number of days since an undefined epoch.
+// */
+// days to_days() const
+// {
+// return days(day_number_from_ymd());
+// }
+ public:
 
       /**
- * Returns: day(d_).
+ * Conversion from @c days_date
        */
- day get_day() const BOOST_NOEXCEPT
- {
- return day(d_);
- }
+ explicit ymd_date(days_date dt);
       /**
- * Returns: month(m_).
+ * Conversion from @c days
        */
- month get_month() const BOOST_NOEXCEPT
- {
- return month(m_);
- }
+ explicit ymd_date(days d);
+
       /**
- * Returns: year(y_).
+ * Conversion to @c days_date
        */
- year get_year() const BOOST_NOEXCEPT
- {
- return year(y_);
- }
- month_day get_month_day() const BOOST_NOEXCEPT
- {
- return month_day(month(m_), day(d_));
- }
- year_month get_year_month() const BOOST_NOEXCEPT
- {
- return year_month(year(y_),month(m_));
- }
- year_month_day get_year_month_day() const BOOST_NOEXCEPT
+ //BOOST_CHRONO_EXPLICT
+ operator days_date() const
       {
- return year_month_day(year(y_),month(m_),day(d_));
+ return days_date(days(day_number_from_ymd()));
       }
+
       /**
- * Returns: true if year() is a leap year, and otherwise returns false.
+ * Returns: chrono::day(d_).
        */
- bool is_leap_year() const BOOST_NOEXCEPT
+ BOOST_CONSTEXPR chrono::day to_day() const BOOST_NOEXCEPT
       {
- return leap_;
+ return chrono::day(d_);
       }
-
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
       /**
- * @Returns: A weekday constructed with an int corresponding to *this
- * ymd_date's day of the week (a value in the range of [0 - 6], 0 is Sunday).
+ * Returns: chrono::day(d_).
        */
- weekday get_weekday() const BOOST_NOEXCEPT
- {
- return weekday((x_ + 1) % weekday::size);
- }
-#elif BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 3
- weekday get_weekday() const BOOST_NOEXCEPT
+ //BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
       {
- return weekday((day_number_from_ymd()+1) % weekday::size);
+ return chrono::day(d_);
       }
-#endif
-
       /**
- * @Effects: Adds d.count() days to the current ymd_date.
- * @Returns: *this.
- * @Throws: If the addition would create a ymd_date with a y_ outside of the
- * range of year, throws an exception of type bad_date.
- *
+ * Returns: chrono::month(m_).
        */
- ymd_date& operator+=(days d);
-
- /**
- * @Effects: *this += days(1).
- * @Returns: *this.
- */
- ymd_date& operator++()
+ BOOST_CONSTEXPR chrono::month to_month() const BOOST_NOEXCEPT
       {
- return *this += days(1);
+ return chrono::month(m_);
       }
       /**
- * @Effects: *this += days(1).
- * @Returns: A copy of *this prior to the increment.
+ * Returns: chrono::month(m_).
        */
- ymd_date operator++(int)
+ //BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
       {
- ymd_date tmp(*this);
- ++(*this);
- return tmp;
+ return chrono::month(m_);
       }
       /**
- * @Effects: *this += -d.
- * @Returns: *this.
+ * Returns: chrono::year(y_).
        */
- ymd_date& operator-=(days d)
+ BOOST_CONSTEXPR chrono::year to_year() const BOOST_NOEXCEPT
       {
- return *this += -d;
+ return chrono::year(y_);
       }
       /**
- * @Effects: *this -= days(1).
- * @Returns: *this.
+ * Returns: chrono::year(y_).
        */
- ymd_date& operator--()
+ //BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
+ BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
       {
- return *this -= days(1);
+ return chrono::year(y_);
       }
- /**
- * @Effects: *this -= days(1).
- * @Returns: A copy of *this prior to the increment.
- */
- ymd_date operator--(int)
+ chrono::month_day get_month_day() const BOOST_NOEXCEPT
       {
- ymd_date tmp(*this); --(*this); return tmp;
+ return chrono::month_day(chrono::month(m_), chrono::day(d_));
       }
-
- /**
- * @Returns: dt += d.
- *
- */
- friend ymd_date operator+(ymd_date dt, days d)
+ chrono::year_month get_year_month() const BOOST_NOEXCEPT
       {
- dt += d;
- return dt;
+ return chrono::year_month(chrono::year(y_),chrono::month(m_));
       }
- /**
- * @Returns: dt += d.
- *
- */
- friend ymd_date operator+(days d, ymd_date dt)
+ chrono::year_month_day get_year_month_day() const BOOST_NOEXCEPT
       {
- dt += d;
- return dt;
+ return chrono::year_month_day(chrono::year(y_),chrono::month(m_),chrono::day(d_));
       }
       /**
- * @Returns: dt -= d.
- *
+ * Returns: whether year() is a leap year.
        */
- friend ymd_date operator-(ymd_date dt, days d)
+ BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
       {
- dt -= d;
- return dt;
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ return leap_;
+#else
+ return is_leap(y_);
+#endif
       }
+
       /**
- * @Returns: Computes the number of days x is ahead of y in the calendar,
- * and returns that signed integral number n as days(n).
+ * @Returns: A weekday constructed with an int corresponding to *this
+ * ymd_date's day of the week (a value in the range of [0 - 6], 0 is Sunday).
+ *
+ * @Notes this function needs a conversion to @c days_date, so maybe you would do better to not use it.
+ *
        */
- friend days operator-(ymd_date x, ymd_date y) BOOST_NOEXCEPT
+ chrono::weekday to_weekday() const BOOST_NOEXCEPT
       {
- return days(x.days_since_epoch() - y.days_since_epoch());
- }
- friend days operator-(days_date x, ymd_date y) BOOST_NOEXCEPT
- {
- return days(x.days_since_epoch() - y.days_since_epoch());
- }
- friend days operator-(ymd_date x, days_date y) BOOST_NOEXCEPT
- {
- return days(x.days_since_epoch() - y.days_since_epoch());
+ return chrono::weekday((day_number_from_ymd()+1) % chrono::weekday::size);
       }
 
+// /**
+// * @Effects: Adds d.count() days to the current ymd_date.
+// * @Returns: *this.
+// * @Throws: If the addition would create a ymd_date with a y_ outside of the
+// * range of year, throws an exception of type bad_date.
+// *
+// */
+// ymd_date& operator+=(days d);
+//
+// /**
+// * @Effects: *this += days(1).
+// * @Returns: *this.
+// */
+// ymd_date& operator++()
+// {
+// return *this += days(1);
+// }
+// /**
+// * @Effects: *this += days(1).
+// * @Returns: A copy of *this prior to the increment.
+// */
+// ymd_date operator++(int)
+// {
+// ymd_date tmp(*this);
+// ++(*this);
+// return tmp;
+// }
+// /**
+// * @Effects: *this += -d.
+// * @Returns: *this.
+// */
+// ymd_date& operator-=(days d)
+// {
+// return *this += -d;
+// }
+// /**
+// * @Effects: *this -= days(1).
+// * @Returns: *this.
+// */
+// ymd_date& operator--()
+// {
+// return *this -= days(1);
+// }
+// /**
+// * @Effects: *this -= days(1).
+// * @Returns: A copy of *this prior to the increment.
+// */
+// ymd_date operator--(int)
+// {
+// ymd_date tmp(*this); --(*this); return tmp;
+// }
+//
+// /**
+// * @Returns: dt += d.
+// *
+// */
+// friend ymd_date operator+(ymd_date dt, days d)
+// {
+// dt += d;
+// return dt;
+// }
+// /**
+// * @Returns: dt += d.
+// *
+// */
+// friend ymd_date operator+(days d, ymd_date dt)
+// {
+// dt += d;
+// return dt;
+// }
+// /**
+// * @Returns: dt -= d.
+// *
+// */
+// friend ymd_date operator-(ymd_date dt, days d)
+// {
+// dt -= d;
+// return dt;
+// }
+// /**
+// * @Returns: Computes the number of days x is ahead of y in the calendar,
+// * and returns that signed integral number n as days(n).
+// */
+// friend days operator-(ymd_date x, ymd_date y) BOOST_NOEXCEPT
+// {
+// return days(x.days_since_epoch() - y.days_since_epoch());
+// }
+// friend days operator-(days_date x, ymd_date y) BOOST_NOEXCEPT
+// {
+// return days(x.days_since_epoch() - y.days_since_epoch());
+// }
+// friend days operator-(ymd_date x, days_date y) BOOST_NOEXCEPT
+// {
+// return days(x.days_since_epoch() - y.days_since_epoch());
+// }
+
       /**
        * @Effects Adds m.count() months to the current ymd_date.
        * This is accomplished as if by storing temporary values of the ymd_date's y_, m_, d_.
@@ -505,51 +694,41 @@
         return dt;
       }
 
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
       /**
- * Returns: x.days_since_epoch() == y.days_since_epoch()
+ * Returns: x.year() == y.year() && x.month() == y.month() && x.day() == y.day()
        */
- friend bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
       {
- return x.x_ == y.x_;
+ return x.y_ == y.y_ && x.m_ == y.m_ && x.d_ == y.d_;
       }
       /**
- * Returns: x.days_since_epoch() < y.days_since_epoch()
+ * Returns: x.year_month_day() < y.year_month_day() in lexicographic order.
        */
- friend bool operator< (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
- {
- return x.x_ < y.x_;
- }
-#elif BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 3
- friend bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
- {
- return x.y_ == y.y_ && x.m_ == y.m_ && x.d_ == y.d_;
- }
- friend bool operator< (const ymd_date& x, const ymd_date& y)
+ friend BOOST_CONSTEXPR bool operator< (const ymd_date& x, const ymd_date& y)
       {
         return x.y_ < y.y_ ||
         (!(y.y_ < x.y_) && (x.m_ < y.m_ ||
                 (!(y.m_ < x.m_) && x.d_ < y.d_)));
       }
-#endif
+
       /**
        * @Returns: !(x == y).
        */
- friend bool operator!=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator!=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
       {
         return !(x == y);
       }
       /**
        * @Returns: y < x.
        */
- friend bool operator> (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator> (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
       {
         return y < x;
       }
       /**
        * @Returns: !(y < x).
        */
- friend bool operator<=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_CONSTEXPR bool operator<=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
       {
         return !(y < x);
       }
@@ -561,22 +740,16 @@
         return !(x < y);
       }
 
-
-
+#if ! defined BOOST_CHRONO_DATE_DOXYGEN_INVOKED
     private:
 
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 3
       days::rep day_number_from_ymd() const BOOST_NOEXCEPT;
 #endif
- //#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- // day::rep day_from_day_number() const BOOST_NOEXCEPT;
- // month::rep month_from_day_number() const BOOST_NOEXCEPT;
- // year::rep year_from_day_number() const BOOST_NOEXCEPT;
- // bool leap_from_day_number() const BOOST_NOEXCEPT;
- //#endif
 
     };
-
+ /**
+ * Partial specialization of @c is_date<ymd_date> as a @c true_type.
+ */
     template <>
     struct is_date<ymd_date> : true_type {};
 
@@ -588,7 +761,7 @@
 // * @Returns If the parameters represents a valid ymd_date the ymd_date,
 // * otherwise a none optional.
 // */
-// inline optional_ymd_date make_valid_ymd_date(year y,month m,day d) BOOST_NOEXCEPT
+// inline optional_ymd_date make_valid_ymd_date(year y, month m, day d) BOOST_NOEXCEPT
 // {
 // ymd_date res;
 // if (res.set_if_valid_date(y,m,d)) return optional_ymd_date(res);
@@ -600,27 +773,64 @@
     // ymd_date make_ydoy_date(year::rep,day_of_year::rep) BOOST_NOEXCEPT;
     // ymd_date make_epoch_date(days::rep) BOOST_NOEXCEPT;
 
- inline ymd_date operator/(year_month ym, day d)
+ /**
+ * @c ymd_date factory.
+ * @Returns @c ymd_date(year(ym),month(ym),d)
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(year_month ym, day d)
     {
- return ymd_date(ym.get_year(), ym.get_month(), d);
+ return ymd_date(year(ym), month(ym), d);
     }
- inline ymd_date operator/(year_month ym, day::rep d)
+ /**
+ * @c ymd_date factory.
+ * @Returns @c ym/day(d)
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(year_month ym, int d)
     {
       return ym / day(d);
     }
- inline ymd_date operator/(month_day md, year y)
+ /**
+ * @c ymd_date factory.
+ * @Returns @c ymd_date(y,month(md),day(md))
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(month_day md, year y)
     {
- return ymd_date(y, md.get_month(), md.get_day());
+ return ymd_date(y, month(md), day(md));
     }
- inline ymd_date operator/(year y, month_day md)
+ /**
+ * @c ymd_date factory.
+ * @Returns @c ymd_date(y,month(md),day(md))
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(year y, month_day md)
     {
- return ymd_date(y, md.get_month(), md.get_day());
+ return ymd_date(y, month(md), day(md));
     }
- inline ymd_date operator/(month_day md, year::rep y)
+ /**
+ * @c ymd_date factory.
+ * @Returns @c md/year(y)
+ */
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(month_day md, int y)
     {
       return md / year(y);
     }
 
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(year y,month m, day d)
+ {
+ return ymd_date(y, m, d);
+ }
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(year y,month m, int d)
+ {
+ return ymd_date(y, m, day(d));
+ }
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(year y,int m, day d)
+ {
+ return ymd_date(y, month(m), d);
+ }
+ inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(int y,month m, day d)
+ {
+ return ymd_date(year(y), m, d);
+ }
+
   } // chrono
 
 } // boost

Modified: sandbox/chrono_date/libs/date/build/Jamfile.v2
==============================================================================
--- sandbox/chrono_date/libs/date/build/Jamfile.v2 (original)
+++ sandbox/chrono_date/libs/date/build/Jamfile.v2 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -42,6 +42,13 @@
         <toolset>gcc:<cxxflags>-Wextra
         <toolset>gcc:<cxxflags>-pedantic
         <toolset>gcc:<cxxflags>-Wno-long-long
+
+ <toolset>gcc-4.4.6:<cxxflags>-fpermissive
+ <toolset>gcc-4.4.6.0x:<cxxflags>-fpermissive
+
+ <toolset>gcc-4.6.1:<cxxflags>-fpermissive
+ <toolset>gcc-4.6.1.0x:<cxxflags>-fpermissive
+
         <toolset>darwin:<cxxflags>-Wextra
         <toolset>darwin:<cxxflags>-pedantic
         <toolset>darwin:<cxxflags>-Wno-long-long
@@ -53,6 +60,17 @@
         <toolset>darwin-4.7.1x:<cxxflags>-Wno-unused-local-typedefs
         <toolset>darwin-4.7.2x:<cxxflags>-Wno-unused-local-typedefs
         <toolset>darwin-4.8.0x:<cxxflags>-Wno-unused-local-typedefs
+ <toolset>darwin-4.2.1:<cxxflags>-fpermissive
+ <toolset>darwin-4.6.2:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.1:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.0:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.2:<cxxflags>-fpermissive
+ <toolset>darwin-4.8.0:<cxxflags>-fpermissive
+ <toolset>darwin-4.6.2x:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.0x:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.1x:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.2x:<cxxflags>-fpermissive
+ <toolset>darwin-4.8.0x:<cxxflags>-fpermissive
 
         #<toolset>pathscale:<cxxflags>-Wextra
         <toolset>pathscale:<cxxflags>-Wno-long-long

Modified: sandbox/chrono_date/libs/date/doc/Jamfile.v2
==============================================================================
--- sandbox/chrono_date/libs/date/doc/Jamfile.v2 (original)
+++ sandbox/chrono_date/libs/date/doc/Jamfile.v2 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -52,6 +52,7 @@
                                    \"BOOST_STATIC_CONSTANT(x,y)=static x const y\" \\
                                    \"BOOST_STATIC_ASSERT(cnd)=\" \\
                                    \"BOOST_CHRONO_DATE_REQUIRES(CND) \" \\
+ \"BOOST_CHRONO_INLINE \" \\
                                    \"BOOST_CONSTEXPR_OR_CONST=constexpr\" \\
                                    \"BOOST_CONSTEXPR=constexpr\"" \\
 
@@ -120,6 +121,7 @@
                                    \"BOOST_STATIC_CONSTANT(x,y)=static x const y\" \\
                                    \"BOOST_STATIC_ASSERT(cnd)=\" \\
                                    \"BOOST_CHRONO_DATE_REQUIRES(CND) \" \\
+ \"BOOST_CHRONO_INLINE \" \\
                                    \"BOOST_CONSTEXPR_OR_CONST=constexpr\" \\
                                    \"BOOST_CONSTEXPR=constexpr\""
 
@@ -189,7 +191,7 @@
       [ glob ../../../boost/chrono/date/weekday.hpp ]
       [ glob ../../../boost/chrono/date/year.hpp ]
    :
- <xsl:param>"boost.doxygen.reftitle=Date Constrained Yypes"
+ <xsl:param>"boost.doxygen.reftitle=Unit Specifiers"
    ;
 
 doxygen tuples
@@ -200,7 +202,7 @@
       [ glob ../../../boost/chrono/date/nth_weekday.hpp ]
       [ glob ../../../boost/chrono/date/nth_weekday.hpp ]
    :
- <xsl:param>"boost.doxygen.reftitle=Tuples"
+ <xsl:param>"boost.doxygen.reftitle=Composite Unit Specifiers"
    ;
 
 doxygen dates
@@ -208,32 +210,38 @@
       [ glob ../../../boost/chrono/date/days_date.hpp ]
       [ glob ../../../boost/chrono/date/ymd_date.hpp ]
       [ glob ../../../boost/chrono/date/ydoy_date.hpp ]
- [ glob ../../../boost/chrono/date/relative_date.hpp ]
- [ glob ../../../boost/chrono/date/date.hpp ]
    :
         <xsl:param>"boost.doxygen.reftitle=Dates"
    ;
 
+doxygen contextual_dates
+ :
+ [ glob ../../../boost/chrono/date/relative_date.hpp ]
+ :
+ <xsl:param>"boost.doxygen.reftitle=Contextual Dates"
+ ;
+
 
 doxygen durations
    :
       [ glob ../../../boost/chrono/date/date_durations.hpp ]
+ [ glob ../../../boost/chrono/date/proleptic_gregorian.hpp ]
    :
- <xsl:param>"boost.doxygen.reftitle=Durations"
+ <xsl:param>"boost.doxygen.reftitle=Date Units"
    ;
 
 doxygen generators
    :
       [ glob ../../../boost/chrono/date/date_generators.hpp ]
    :
- <xsl:param>"boost.doxygen.reftitle=Genarators"
+ <xsl:param>"boost.doxygen.reftitle=Date Genarators"
    ;
 
 doxygen io
    :
       [ glob ../../../boost/chrono/date/date_io.hpp ]
    :
- <xsl:param>"boost.doxygen.reftitle=I/O"
+ <xsl:param>"boost.doxygen.reftitle=Date I/O"
    ;
 
 
@@ -319,6 +327,7 @@
         <dependency>config
         <dependency>exceptions
         <dependency>no_check
+ <dependency>contextual_dates
    ;
 
 path-constant boost-root : [ modules.peek : BOOST ] ;

Modified: sandbox/chrono_date/libs/date/example/ex_week_based_year.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/example/ex_week_based_year.cpp (original)
+++ sandbox/chrono_date/libs/date/example/ex_week_based_year.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -14,17 +14,17 @@
 {
   using namespace boost::chrono;
 
- date d = oct / day(12) / 2011;
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< d << '\n';
+ days_date d(oct / day(12) / 2011);
+ std::cout << "date "<< d << '\n';
   int weeknum;
   weekday wd(0);
   year y(0);
   boost::tie(weeknum, wd, y) = date_to_week(d);
 
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< weeknum << " " << wd << " " << y << '\n';
+ std::cout << weeknum << " " << wd << " " << y << '\n';
 
   d = week_to_date(weeknum, wd, y);
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< d << '\n';
+ std::cout << "date "<< d << '\n';
 
   return 0;
 }

Modified: sandbox/chrono_date/libs/date/example/hello_world.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/example/hello_world.cpp (original)
+++ sandbox/chrono_date/libs/date/example/hello_world.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -32,33 +32,36 @@
     std::cout << feb/day(1)/2011 << '\n'; // 2011-01-02
 
     // Print Feb. 28 for each year in the decade
- for (date d = feb/day(28)/2010, e = feb/day(28)/2020; d <= e; d += years(1))
+ for (ymd_date d = feb/day(28)/2010, e = feb/day(28)/2020; d <= e; d += years(1))
         std::cout << d << '\n';
     std::cout << '\n';
 
 
     // Print the day after Feb. 28 for each year in the decade
- for (date d = feb/day(28)/2010, e = feb/day(28)/2020; d <= e; d += years(1))
+ for (ymd_date d = feb/day(28)/2010, e = feb/day(28)/2020; d <= e; d += years(1))
+ std::cout << days_date(d) + days(1) << '\n';
+ std::cout << '\n';
+ for (days_date d = feb/day(28)/2010, e = feb/day(28)/2020; d <= e; d = ymd_date(d)+years(1))
         std::cout << d + days(1) << '\n';
     std::cout << '\n';
 
     // Print the 28th of every month in 2011
- for (date d = jan/day(28)/2011, e = dec/day(28)/2011; d <= e; d += months(1))
+ for (ymd_date d = jan/day(28)/2011, e = dec/day(28)/2011; d <= e; d += months(1))
         std::cout << d << '\n';
     std::cout << '\n';
 
     {
     // How many days between may/1/2011 and jan/1/2011?
- std::cout <<"How many days between may/1/2011 and jan/1/2011? "<< (may/day(01)/2011 - jan/day(01)/2011) << '\n'; // x == 120
+ std::cout <<"How many days between may/1/2011 and jan/1/2011? "<< days_date(may/day(01)/2011) - jan/day(01)/2011 << '\n'; // x == 120
 
     std::cout << '\n';
     }
 
     {
     date dt = aug/day(16)/2011;
- int d = dt.get_day(); // d == 16
- int m = dt.get_month(); // m == 8
- int y = dt.get_year(); // y == 2011
+ int d = day(dt); // d == 16
+ int m = month(dt); // m == 8
+ int y = year(dt); // y == 2011
     std::cout << dt << '\n';
     std::cout << y << " " << m << " " << d << '\n';
     std::cout << '\n';
@@ -68,20 +71,20 @@
     date dt = aug/day(16)/2011;
     // ...
     // Create date with the same month and year but on the 5th
- date dt2 = dt.get_year()/dt.get_month()/5; // aug/5/2011
+ date dt2 = year(dt)/month(dt)/5; // aug/5/2011
     (void)dt2;
- int d = dt.get_day(); // d == 5
- int m = dt.get_month(); // m == 8
- int y = dt.get_year(); // y == 2011
+ int d = day(dt); // d == 5
+ int m = month(dt); // m == 8
+ int y = year(dt); // y == 2011
     std::cout << dt << '\n';
     std::cout << y << " " << m << " " << d << '\n';
     std::cout << '\n';
     }
 
     {
- date dt = aug/day(16)/2011;
+ days_date dt = aug/day(16)/2011;
       // What day of the week is this?
- int wd = dt.get_weekday(); // 2 (Tuesday)
+ int wd = weekday(dt); // 2 (Tuesday)
       std::cout << dt << '\n';
       std::cout << wd << '\n';
     }
@@ -89,14 +92,14 @@
     {
       std::cout << date_fmt("%a %b %e, %Y");
       // Print the odd fridays of every month in 2011
- for (date d = jan/day(28)/2011, e = dec/day(28)/2011; d <= e; d += months(1))
+ for (ymd_date d = jan/day(28)/2011, e = dec/day(28)/2011; d <= e; d += months(1))
       {
           std::cout << d << '\n'; // first Friday of the month
       }
     }
     {
       Clock::time_point t0 = Clock::now();
- for (date d = feb/day(28)/2010, e = feb/day(28)/2020; d != e; d += years(1))
+ for (ymd_date d = feb/day(28)/2010, e = feb/day(28)/2020; d != e; d += years(1))
         ;
       Clock::time_point t1 = Clock::now();
       std::cout << " iterate: " << micros(t1 - t0) << "\n";
@@ -130,8 +133,8 @@
     }
 
     {
-// int num_fri_in_may = (_fri[last]/may/2011).get_day() > 28 ? 5 : 4; // 4
- int num_fri_in_may = (last*fri/may/2011).get_day() > 28 ? 5 : 4; // 4
+// int num_fri_in_may = (_fri[last]/may/2011).day() > 28 ? 5 : 4; // 4
+ int num_fri_in_may = day(last*fri/may/2011) > 28 ? 5 : 4; // 4
       std::cout <<"Number of fridays in May"<< num_fri_in_may << '\n';
 
 // date d1 = rel_weekday(5)[_1st]/may/2011;
@@ -145,7 +148,7 @@
 
     {
       // Print the last day in Feb. for each year in the decade
- for (date d = feb/last/2010, e = feb/last/2020; d <= e; d += years(1))
+ for (ymd_date d = feb/last/2010, e = feb/last/2020; d <= e; d += years(1))
           std::cout << d << '\n';
       std::cout << feb/last/2020 << '\n';
     }
@@ -183,8 +186,8 @@
       // Print the 29th of every month in 2011
       for (rel_date d = last/jan/2011, e = last/dec/2011; d <= e; d += months(1))
       {
- if (d.get_day() >= 29)
- std::cout << d.get_year()/d.get_month()/29 << '\n';
+ if (day(d) >= 29)
+ std::cout << year(d)/month(d)/29 << '\n';
       }
     }
     {
@@ -196,7 +199,7 @@
     {
       // Print out every monday between jan/1/2011 and mar/1/2011;
       //for (date d = _mon[_1st]/jan/2011, e = mar/_1st/2011; d <= e; d += days(7))
- for (date d = _1st*mon/jan/2011, e = mar/_1st/2011; d <= e; d += days(7))
+ for (days_date d = _1st*mon/jan/2011, e = mar/_1st/2011; d <= e; d += days(7))
           std::cout << d << '\n';
     }
     {
@@ -208,40 +211,40 @@
       }
     }
     {
- date dt = aug/day(16)/2011;
+ ymd_date dt(aug/day(16)/2011);
       // ...
       // Get the date that is the first occurrence of the same day of the week
       // in the same month of the next year
- //rel_date dt2 = dt.get_weekday()[_1st]/dt.get_month()/(dt.get_year() + 1); // aug/7/2012, first Tuesday of Aug 2012
- rel_date dt2 = _1st*dt.get_weekday()/dt.get_month()/(dt.get_year() + 1); // aug/7/2012, first Tuesday of Aug 2012
+ //rel_date dt2 = weekday(dt)[_1st]/month(dt)/(year(dt) + 1); // aug/7/2012, first Tuesday of Aug 2012
+ rel_date dt2 = _1st*weekday(days_date(dt))/month(dt)/(year(dt) + 1); // aug/7/2012, first Tuesday of Aug 2012
       std::cout << dt << '\n';
       std::cout << dt2 << '\n';
     }
     {
- date ISO_week_start = mon <= jan/day(4)/2012;
+ ymd_date ISO_week_start(mon <= jan/day(4)/2012);
       std::cout << "ISO_week_start " << ISO_week_start << '\n';
     }
 
     {
       // How many weeks until Christmas?
- date dt = dec/day(25)/2011;
+ days_date dt = dec/day(25)/2011;
       days d=dt- date::today();
       std::cout << duration_cast<weeks>(d)<< '\n';
     }
     {
       // How many average months until Christmas?
- days d = (dec/day(25)/2011) - date::today();
+ days d = days_date(dec/day(25)/2011) - date::today();
       std::cout << duration_cast<average_months>(d)<< '\n';
     }
     {
       // How many weeks until Christmas?
- days d=(dec/day(25)>date::today())- date::today();
+ days d=days_date(dec/day(25) > date::today()) - date::today();
       std::cout << duration_cast<weeks>(d)<< '\n';
     }
     {
       std::cout << __FILE__<<"["<<__LINE__ <<"] "<< "How many days until next 28th?" << '\n';
       // How many days until next 28th?
- days d=(nth(5)>date::today())- date::today();
+ days d=days_date(nth(5)>date::today()) - date::today();
       std::cout << d << '\n';
     }
     {

Modified: sandbox/chrono_date/libs/date/example/julian.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/example/julian.cpp (original)
+++ sandbox/chrono_date/libs/date/example/julian.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -117,10 +117,10 @@
 
   date::date(boost::chrono::date d)
   {
- uint32_t by = d.get_year() + 32799;
+ uint32_t by = boost::chrono::year(d) + 32799;
     int* year_data = db[is_civil_leap(by)];
- x_ = by * 365 + by / 4 - by / 100 + by / 400 + 248 + year_data[d.get_month()
- - 1] + d.get_day();
+ x_ = by * 365 + by / 4 - by / 100 + by / 400 + 248 + year_data[boost::chrono::month(d)
+ - 1] + boost::chrono::day(d);
     int y = static_cast<int> (static_cast<int64_t> (x_ + 1) * 4 / 1461);
     int doy = x_ - (y * 365 + y / 4);
     if (doy < 0)

Modified: sandbox/chrono_date/libs/date/example/julian.hpp
==============================================================================
--- sandbox/chrono_date/libs/date/example/julian.hpp (original)
+++ sandbox/chrono_date/libs/date/example/julian.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -668,15 +668,18 @@
     // explicit
     operator boost::chrono::date() const;
 
- julian::day get_day() const
+ operator julian::day() const
     { return julian::day(d_);}
- julian::month get_month() const
+ //julian::month month() const
+ operator julian::month() const
     { return julian::month(m_);}
- julian::year get_year() const
+ //julian::year year() const
+ operator julian::year() const
     { return julian::year(y_);}
     bool is_leap_year() const
     { return leap_;}
- julian::weekday get_weekday() const
+ //julian::weekday weekday() const
+ operator julian::weekday() const
     { return julian::weekday((x_+5) % 7);}
 
     date& operator+=(days d);
@@ -750,7 +753,7 @@
   operator >>(std::basic_istream<charT,traits>& is, date& item)
   {
     typename std::basic_istream<charT,traits>::sentry ok(is);
- if (ok)
+ if (bool(ok))
     {
       std::ios_base::iostate err = std::ios_base::goodbit;
       try
@@ -788,7 +791,7 @@
   operator <<(std::basic_ostream<charT, traits>& os, const date& item)
   {
     typename std::basic_ostream<charT, traits>::sentry ok(os);
- if (ok)
+ if (bool(ok))
     {
       bool failed;
       try
@@ -796,10 +799,10 @@
         const std::time_put<charT>& tp = std::use_facet<std::time_put<charT> >
         (os.getloc());
         std::tm t;
- t.tm_mday = item.get_day();
- t.tm_mon = item.get_month() - 1;
- t.tm_year = item.get_year() - 1900;
- t.tm_wday = item.get_weekday();
+ t.tm_mday = day(item);
+ t.tm_mon = month(item) - 1;
+ t.tm_year = year(item) - 1900;
+ t.tm_wday = weekday(item);
         charT pattern[] =
         { '%', 'F'};
         const charT* pb = pattern;

Modified: sandbox/chrono_date/libs/date/example/week_based_year.hpp
==============================================================================
--- sandbox/chrono_date/libs/date/example/week_based_year.hpp (original)
+++ sandbox/chrono_date/libs/date/example/week_based_year.hpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -9,45 +9,40 @@
 #ifndef BOOST_CHRONO_EXAMPLE_DATE_WEEK_BASED_YEAR_HPP
 #define BOOST_CHRONO_EXAMPLE_DATE_WEEK_BASED_YEAR_HPP
 
-#include <boost/chrono/date/ymd_date.hpp>
 #include <boost/chrono/date/date_generators.hpp>
 #include <boost/chrono/date/date_io.hpp>
 #include <boost/chrono/date/relative_date.hpp>
+#include <boost/chrono/date/days_date.hpp>
 #include <boost/tuple/tuple.hpp>
 
 inline boost::tuple<int, boost::chrono::weekday, boost::chrono::year>
-date_to_week(boost::chrono::date d)
+date_to_week(boost::chrono::days_date d)
 {
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< std::endl;
   using namespace boost::chrono;
- month_day jan4 = jan / day(4);
- date start = mon <= jan4 / d.get_year();
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< start << std::endl;
+ const month_day jan4 = jan / day(4);
+ days_date start = mon <= jan4 / d.to_year();
   if (d < start)
   {
- start = mon <= jan4 / (d.get_year() - 1);
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< start << std::endl;
+ start = mon <= (jan4 / (d.to_year() - 1));
   } else
   {
- date next_start = mon <= jan4 / (start.get_year() + 1);
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< next_start << std::endl;
+ days_date next_start = mon <= (jan4 / (start.to_year() + 1));
     if (d >= next_start) {
       start = next_start;
- std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< start << std::endl;
     }
   }
   return boost::tuple<int, weekday, year>(
       (d - start).count() / 7 + 1,
- d.get_weekday(),
- (thu > start).get_year()
+ weekday(d),
+ (thu > start).to_year()
     );
 }
 
-inline boost::chrono::date
+inline boost::chrono::days_date
 week_to_date(int weeknum, boost::chrono::weekday wd, boost::chrono::year y)
 {
   using namespace boost::chrono;
- return (mon <= jan / day(4) / y) + days((weeknum - 1) * 7 + (wd == 0 ? 6 : wd - 1));
+ return (mon <= (jan/day(4)/y)) + days((weeknum - 1) * 7 + (wd == 0 ? 6 : wd - 1));
 }
 
 #endif // header

Added: sandbox/chrono_date/libs/date/index.html
==============================================================================
--- (empty file)
+++ sandbox/chrono_date/libs/date/index.html 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -0,0 +1,15 @@
+<html>
+ <head>
+ <meta http-equiv="refresh" content="0; URL=../../doc/html/date.html">
+ </head>
+ <body>
+ Automatic redirection failed, please go to
+ ../../doc/html/date.html
+ <p>&copy; Copyright 2009-2010 Vicente J. Botet Escrib&aacute;.
+ Distributed under the Boost Software
+ License, Version 1.0. (See accompanying file <a href="../../LICENSE_1_0.txt">
+ LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
+ http://www.boost.org/LICENSE_1_0.txt>)
+ </p>
+ </body>
+</html>

Added: sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -0,0 +1,230 @@
+// Copyright 2011 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See
http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/chrono/date.hpp>
+#include <boost/chrono/date/conversions.hpp>
+
+//namespace boost
+//{
+// namespace chrono
+// {
+//inline days::rep to_days(int y, int m, int d) BOOST_NOEXCEPT
+//{
+// bool leap = is_leap(y);
+// year::rep by = y - 32799;
+// return days_before_year(by) +
+// days_in_year_before(leap,m-1) +
+// d;
+//}
+// }}
+
+using namespace boost::chrono;
+const int Ymin = 1900;
+const int Ymax = 2100;
+volatile int y;
+volatile int m;
+volatile int d;
+volatile boost::int_least16_t m16;
+volatile boost::int_least16_t d16;
+
+//#define VOLATILE
+//#define CHECK_IS_VALID(d) if(d.is_valid())
+
+#define VOLATILE volatile
+#define CHECK_IS_VALID(d)
+
+
+void empty_encoding_perf()
+{
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int y = Ymin; y <= Ymax; ++y)
+ {
+ bool is_l = year(y).is_leap();
+ for (int m = 1; m <= 12; ++m)
+ {
+ int last = month(m).days_in(is_l).count();
+ for (int d = 1; d <= last; ++d)
+ {
+ ++count;
+ }
+ }
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto encode = t1 - t0;
+ //std::cout << encode.count() / count << '\n';
+ std::cout << "ENCODE empty " << sec(encode).count() / count << '\n';
+}
+
+void raw_encoding_perf()
+{
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int y = Ymin; y <= Ymax; ++y)
+ {
+ bool is_l = year(y).is_leap();
+ for (int m = 1; m <= 12; ++m)
+ {
+ int last = month(m).days_in(is_l).count();
+ for (int d = 1; d <= last; ++d)
+ {
+ volatile days::rep ds = to_days(y, m, d);
+ ++count;
+ }
+ }
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto encode = t1 - t0;
+ //std::cout << encode.count() / count << '\n';
+ std::cout << "ENCODE raw " << sec(encode).count() / count << '\n';
+}
+
+void raw_space_encoding_perf()
+{
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int y = Ymin; y <= Ymax; ++y)
+ {
+ bool is_l = year(y).is_leap();
+ for (int m = 1; m <= 12; ++m)
+ {
+ int last = month(m).days_in(is_l).count();
+ for (int d = 1; d <= last; ++d)
+ {
+ volatile days::rep ds = to_days((boost::int_least32_t)y, (boost::int_least16_t)m, (boost::int_least16_t)d);
+ ++count;
+ }
+ }
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto encode = t1 - t0;
+ //std::cout << encode.count() / count << '\n';
+ std::cout << "ENCODE space " << sec(encode).count() / count << '\n';
+}
+
+void class_encoding_perf()
+{
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int y = Ymin; y <= Ymax; ++y)
+ {
+ bool is_l = year(y).is_leap();
+ for (int m = 1; m <= 12; ++m)
+ {
+ int last = month(m).days_in(is_l).count();
+ for (int d = 1; d <= last; ++d)
+ {
+ volatile days::rep ds = days_date(ymd_date(year(y), month(m), d)).days_since_epoch().count();
+
+ ++count;
+ }
+ }
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto encode = t1 - t0;
+ //std::cout << encode.count() / count << '\n';
+ std::cout << "ENCODE class " << sec(encode).count() / count << '\n';
+}
+
+void empty_decoding_perf()
+{
+
+ const int k0 = days_date(year(Ymin)/month(1)/1).days_since_epoch().count();
+ const int k1 = days_date(year(Ymax)/month(12)/31).days_since_epoch().count();
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int k = k0; k <= k1; ++k)
+ {
+ VOLATILE days_date dt1((days(k)));
+ ++count;
+
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto decode = t1 - t0;
+ //std::cout << decode.count() / count << '\n';
+ std::cout << "DECODE empty " << sec(decode).count() / count << '\n';
+}
+void raw_decoding_perf()
+{
+
+ const int k0 = days_date(year(Ymin)/month(1)/1).days_since_epoch().count();
+ const int k1 = days_date(year(Ymax)/month(12)/31).days_since_epoch().count();
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int k = k0; k <= k1; ++k)
+ {
+ VOLATILE days_date dt1((days(k)));
+ to_ymd(const_cast<days_date&>(dt1).days_since_epoch().count(), const_cast<int&>(y),const_cast<int &>(m),const_cast<int&>(d));
+ ++count;
+
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto decode = t1 - t0;
+ //std::cout << decode.count() / count << '\n';
+ std::cout << "DECODE raw " << sec(decode).count() / count << '\n';
+}
+
+void raw_space_decoding_perf()
+{
+
+ const int k0 = days_date(year(Ymin)/month(1)/1).days_since_epoch().count();
+ const int k1 = days_date(year(Ymax)/month(12)/31).days_since_epoch().count();
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int k = k0; k <= k1; ++k)
+ {
+ VOLATILE days_date dt1((days(k)));
+ to_ymd(const_cast<days_date&>(dt1).days_since_epoch().count(), const_cast<boost::int_least32_t&>(y),const_cast<boost::int_least16_t &>(m16),const_cast<boost::int_least16_t&>(d16));
+ ++count;
+
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto decode = t1 - t0;
+ //std::cout << decode.count() / count << '\n';
+ std::cout << "DECODE space " << sec(decode).count() / count << '\n';
+}
+
+void class_decoding_perf()
+{
+
+ const int k0 = days_date(year(Ymin)/month(1)/1).days_since_epoch().count();
+ const int k1 = days_date(year(Ymax)/month(12)/31).days_since_epoch().count();
+ int count = 0;
+ auto t0 = boost::chrono::high_resolution_clock::now();
+ for (int k = k0; k <= k1; ++k)
+ {
+ VOLATILE days_date dt1((days(k)));
+ VOLATILE ymd_date dt2(const_cast<days_date&>(dt1));
+ ++count;
+
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto decode = t1 - t0;
+ //std::cout << decode.count() / count << '\n';
+ std::cout << "DECODE class " << sec(decode).count() / count << '\n';
+}
+
+int main()
+{
+ empty_encoding_perf();
+ raw_encoding_perf();
+ raw_space_encoding_perf();
+ class_encoding_perf();
+ empty_decoding_perf();
+ raw_decoding_perf();
+ raw_space_decoding_perf();
+ class_decoding_perf();
+
+ return 1;
+}
+

Modified: sandbox/chrono_date/libs/date/src/conversions.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/conversions.cpp (original)
+++ sandbox/chrono_date/libs/date/src/conversions.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -8,6 +8,7 @@
 
 #include <algorithm>
 #include <boost/chrono/date/conversions.hpp>
+#include <boost/chrono/date/tuples.hpp>
 #include <boost/chrono/date/detail/helpers.hpp>
 
 namespace boost
@@ -54,29 +55,86 @@
 // return year_month_day_leap(y, m, d, leap);
 //
 // }
+
+ void to_ymd(days::rep x_, int& y, int& m, int& d) BOOST_NOEXCEPT
+ {
+ y = static_cast<year::rep>(static_cast<int64_t>(x_ + 2) * 400 / 146097);
+ int doy = x_ - days_before_year(y);
+ if (doy < 0)
+ {
+ --y;
+ doy = x_ - days_before_year(y);
+ }
+ //y += (year::first_-1);
+ y -= 32799;
+ const bool leap = is_leap(y);
+ m = day_of_year_month(leap,doy+1);
+ d = day_of_year_day_of_month(leap,doy+1);
+ }
+
+ void to_ymd(days::rep x_, int_least32_t& y, int_least16_t& m, int_least16_t& d) BOOST_NOEXCEPT
+ {
+ y = static_cast<int_least32_t>(static_cast<int64_t>(x_ + 2) * 400 / 146097);
+ int doy = x_ - days_before_year(y);
+ if (doy < 0)
+ {
+ --y;
+ doy = x_ - days_before_year(y);
+ }
+ //y += (year::first_-1);
+ y -= 32799;
+ const bool leap = is_leap(y);
+ m = day_of_year_month(leap,doy+1);
+ d = day_of_year_day_of_month(leap,doy+1);
+ }
+
+// int_least16_t to_ymdl(days::rep x_, int_least32_t y, int_least16_t& m, int_least16_t& d, bool& leap) BOOST_NOEXCEPT
+// {
+// y = static_cast<int_least32_t>(static_cast<int64_t>(x_ + 2) * 400 / 146097);
+// int doy = x_ - days_before_year(y);
+// if (doy < 0)
+// {
+// --y;
+// doy = x_ - days_before_year(y);
+// }
+// //y += (year::first_-1);
+// y -= 32799;
+// leap = is_leap(y);
+// m = day_of_year_month(leap,doy+1);
+// d = day_of_year_day_of_month(leap,doy+1);
+// return y;
+// }
+ void to_ymdl(days::rep x_, int_least32_t& y, int_least16_t& m, int_least16_t& d, bool& leap) BOOST_NOEXCEPT
+ {
+ y = static_cast<int_least32_t>(static_cast<int64_t>(x_ + 2) * 400 / 146097);
+ int doy = x_ - days_before_year(y);
+ if (doy < 0)
+ {
+ --y;
+ doy = x_ - days_before_year(y);
+ }
+ //y += (year::first_-1);
+ y -= 32799;
+ leap = is_leap(y);
+ m = day_of_year_month(leap,doy+1);
+ d = day_of_year_day_of_month(leap,doy+1);
+ }
+
     year_month_day to_ymd(days dt) BOOST_NOEXCEPT
     {
       days::rep x_ = dt.count();
-// std::cout <<"days " << x_ << std::endl;
       year::rep y = static_cast<year::rep>(static_cast<int64_t>(x_ + 2) * 400 / 146097);
-// std::cout <<"y " << y << std::endl;
       int doy = x_ - days_before_year(y);
-// std::cout <<"doy " << doy << std::endl;
       if (doy < 0)
       {
         --y;
         doy = x_ - days_before_year(y);
-// std::cout <<"y " << y << std::endl;
-// std::cout <<"doy " << doy << std::endl;
       }
       //y += (year::first_-1);
       y -= 32799;
-// std::cout <<"y " << y << std::endl;
       const bool leap = is_leap(y);
       const month::rep m = day_of_year_month(leap,doy+1);
-// std::cout <<"m " << int(m) << std::endl;
       const day::rep d = day_of_year_day_of_month(leap,doy+1);
-// std::cout <<"d " << int(d) << std::endl;
       return year_month_day(year(y), month(m), day(d));
     }
     year_month_day_leap to_ymd_leap(days dt) BOOST_NOEXCEPT
@@ -99,23 +157,46 @@
 
     days to_days(year_month_day dt) BOOST_NOEXCEPT
     {
- bool leap = dt.get_year().is_leap();
- //year::rep by = dt.get_year().value() - (year::first_-1);
- year::rep by = dt.get_year().value() - 32799;
+ bool leap = year(dt).is_leap();
+ //year::rep by = year(dt) - (year::first_-1);
+ year::rep by = year(dt) - 32799;
       return days(days_before_year(by) +
- days_in_year_before(leap,dt.get_month().value()-1) +
- dt.get_day().value());
+ days_in_year_before(leap,month(dt)-1) +
+ day(dt));
+ }
+ days::rep to_days(int_least32_t y, int_least16_t m, int_least16_t d) BOOST_NOEXCEPT
+ {
+ bool leap = is_leap(y);
+ int_least32_t by = y - 32799;
+ return days_before_year(by) +
+ days_in_year_before(leap,m-1) +
+ d;
+ }
+ days::rep to_days(int_least32_t y, int_least16_t m, int_least16_t d, bool leap) BOOST_NOEXCEPT
+ {
+ int_least32_t by = y - 32799;
+ return days_before_year(by) +
+ days_in_year_before(leap,m-1) +
+ d;
+ }
+ days::rep to_days(int y, int m, int d) BOOST_NOEXCEPT
+ {
+ bool leap = is_leap(y);
+ year::rep by = y - 32799;
+ return days_before_year(by) +
+ days_in_year_before(leap,m-1) +
+ d;
     }
 
     days to_days(year_day_of_year dt) BOOST_NOEXCEPT
     {
- return days(days_before_year(dt.get_year())+dt.get_day_of_year());
+ return days(days_before_year(year(dt))+day_of_year(dt));
     }
 
     year_month_day to_ymd(year_day_of_year dt) BOOST_NOEXCEPT
     {
- bool leap=dt.get_year().is_leap();
- return year_month_day(year(dt.get_year()), month(day_of_year_month(leap,dt.get_day_of_year())), day(day_of_year_day_of_month(leap,dt.get_day_of_year())));
+ bool leap=year(dt).is_leap();
+ return year_month_day(year(year(dt)), month(day_of_year_month(leap,day_of_year(dt))), day(day_of_year_day_of_month(leap,day_of_year(dt))));
     }
 
 
@@ -137,8 +218,8 @@
 
     year_day_of_year to_ydoy(year_month_day dt) BOOST_NOEXCEPT
     {
- day_of_year::rep doy = month_day_to_day_of_year(dt.get_year().is_leap(),dt.get_month(),dt.get_day());
- return year_day_of_year(year(dt.get_year()), day_of_year(doy+1));
+ day_of_year::rep doy = month_day_to_day_of_year(year(dt).is_leap(),month(dt),day(dt));
+ return year_day_of_year(year(year(dt)), day_of_year(doy+1));
     }
 
 

Modified: sandbox/chrono_date/libs/date/src/date.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/date.cpp (original)
+++ sandbox/chrono_date/libs/date/src/date.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -160,9 +160,9 @@
     {
       tm now =
       { 0 };
- now.tm_year = get_year() - 1900;
- now.tm_mon = get_month() - 1;
- now.tm_mday = get_day();
+ now.tm_year = year() - 1900;
+ now.tm_mon = month() - 1;
+ now.tm_mday = day();
       time_t t = timegm(&now);
       return system_clock::from_time_t(t);
     }
@@ -256,9 +256,9 @@
     }
     date::date(year y, month_day md, check_t)
     {
- if (set_if_valid_date(y,md.get_month(), md.get_day())) return;
- throw bad_date("day " + to_string(md.get_day()) + " is out of range for "
- + to_string(y) + '-' + to_string(md.get_month()));
+ if (set_if_valid_date(y,month(md), day(md))) return;
+ throw bad_date("day " + to_string(day(md)) + " is out of range for "
+ + to_string(y) + '-' + to_string(month(md)));
     }
 
 #if BOOST_CHRONO_DATE_DATE_DESIGN == 1
@@ -465,9 +465,9 @@
   date::day_from_day_number() const BOOST_NOEXCEPT
   {
     year_day_of_year ydoy = to_ydoy(days(x_));
- return day_of_year_day_of_month(is_leap(ydoy.get_year()),ydoy.get_day_of_year());
-// int m = std::lower_bound(year_data, year_data+13, ydoy.get_day_of_year()) - year_data;
-// return static_cast<uint16_t>(ydoy.get_day_of_year() - year_data[m-1]);
+ return day_of_year_day_of_month(is_leap(year(ydoy)),ydoy.day_of_year());
+// int m = std::lower_bound(year_data, year_data+13, ydoy.day_of_year()) - year_data;
+// return static_cast<uint16_t>(ydoy.day_of_year() - year_data[m-1]);
 
 // int y = to_average_year(x_);
 // int doy = x_ - (days_before_year(y));
@@ -486,7 +486,7 @@
   date::month_from_day_number() const BOOST_NOEXCEPT
   {
     year_day_of_year ydoy = to_ydoy(days(x_));
- return day_of_year_month(is_leap(ydoy.get_year()),ydoy.get_day_of_year());
+ return day_of_year_month(is_leap(year(ydoy)),ydoy.day_of_year());
 
 // int y = to_average_year(x_);
 // int doy = x_ - (days_before_year(y));

Modified: sandbox/chrono_date/libs/date/src/days_date.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/days_date.cpp (original)
+++ sandbox/chrono_date/libs/date/src/days_date.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -18,109 +18,122 @@
   namespace chrono
   {
 
- days_date
- days_date::today()
- BOOST_NOEXCEPT
- {
- time_t systime;
- time(&systime);
- tm now;
- localtime_r(&systime, &now);
- return days_date(year(now.tm_year+1900),month(now.tm_mon+1), day(now.tm_mday));
- }
-
- days_date::days_date(system_clock::time_point tp)
- {
- time_t systime = system_clock::to_time_t(tp);
- tm now;
- gmtime_r(&systime, &now);
- *this
- = days_date(year(now.tm_year + 1900), month(now.tm_mon + 1), day(now.tm_mday));
- }
-
- days_date::operator system_clock::time_point() const
- {
- tm now = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- now.tm_year = get_year() - 1900;
- now.tm_mon = get_month() - 1;
- now.tm_mday = get_day();
- time_t t = timegm(&now);
- return system_clock::from_time_t(t);
- }
-
- bool days_date::set_if_valid_date(year y, month m, day d)
- BOOST_NOEXCEPT
- {
- bool leap = is_leap(y.value());
- const day_of_year::rep* year_data = days_in_year_before(leap);
-
- if (!(d.value() <= year_data[m.value()] - year_data[m.value()-1]))
- {
- return false;
- }
- year::rep by = y.value() + 32799;
- x_ = days_before_year(by) + year_data[m.value()-1] + d.value();
- return true;
-
- }
+// days_date
+// days_date::today()
+// BOOST_NOEXCEPT
+// {
+// time_t systime;
+// time(&systime);
+// tm now;
+// localtime_r(&systime, &now);
+// return days_date(chrono::year(now.tm_year+1900),chrono::month(now.tm_mon+1), chrono::day(now.tm_mday));
+// }
+//
+// days_date::days_date(system_clock::time_point tp)
+// {
+// time_t systime = system_clock::to_time_t(tp);
+// tm now;
+// gmtime_r(&systime, &now);
+// *this
+// = days_date(chrono::year(now.tm_year + 1900), chrono::month(now.tm_mon + 1), chrono::day(now.tm_mday));
+// }
+//
+// days_date::operator system_clock::time_point() const
+// {
+// tm now = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+// now.tm_year = year() - 1900;
+// now.tm_mon = month() - 1;
+// now.tm_mday = day();
+// time_t t = timegm(&now);
+// return system_clock::from_time_t(t);
+// }
 
- days_date::days_date(year y, month m, day d, check_t)
- {
- if (set_if_valid_date(y, m, d))
- return;
- throw bad_date("day " + to_string(d) + " is out of range for "
- + to_string(y) + '-' + to_string(m));
- }
- days_date::days_date(year y, month_day md, check_t)
- {
- if (set_if_valid_date(y, md.get_month(), md.get_day()))
- return;
- throw bad_date("day " + to_string(md.get_day()) + " is out of range for "
- + to_string(y) + '-' + to_string(md.get_month()));
- }
-
- days_date::days_date(year y, month_day md)
- BOOST_NOEXCEPT
+ days_date::days_date(chrono::year y, chrono::month m, chrono::day d) BOOST_NOEXCEPT
     {
       bool leap = is_leap(y);
       const day_of_year::rep* year_data = days_in_year_before(leap);
 
- year::rep by = y + 32799;
- x_ = days_before_year(by) + year_data[md.get_month()-1] + md.get_day();
- }
- days_date::days_date(year y, month m, day d)
- BOOST_NOEXCEPT
- {
- bool leap = is_leap(y);
- const day_of_year::rep* year_data = days_in_year_before(leap);
-
- year::rep by = y + 32799;
- x_ = days_before_year(by) + year_data[m-1] + d;
- }
-
- days_date::days_date(year::rep y, month::rep m, day::rep d, bool leap)
- BOOST_NOEXCEPT
- {
- const day_of_year::rep* year_data = days_in_year_before(leap);
-
+// if (!(d <= year_data[m] - year_data[m-1]))
+// {
+// x_ = 0;
+// }
       year::rep by = y + 32799;
       x_ = days_before_year(by) + year_data[m-1] + d;
     }
 
- days_date::days_date(year y, day_of_year doy, check_t)
- {
- if (!y.is_leap() && doy == 366)
- throw bad_date("doy " + to_string(doy) + " is out of range for year "
- + to_string(y) );
- year::rep by = y + 32799;
- x_ = days_before_year(by) + doy - 1;
- }
- days_date::days_date(year y, day_of_year doy)
- BOOST_NOEXCEPT
- {
- year::rep by = y + 32799;
- x_ = days_before_year(by) + doy - 1;
- }
+// bool days_date::set_if_valid_date(chrono::year y, chrono::month m, chrono::day d)
+// BOOST_NOEXCEPT
+// {
+// bool leap = is_leap(y);
+// const day_of_year::rep* year_data = days_in_year_before(leap);
+//
+// if (!(d <= year_data[m] - year_data[m-1]))
+// {
+// return false;
+// }
+// year::rep by = y + 32799;
+// x_ = days_before_year(by) + year_data[m-1] + d;
+// return true;
+//
+// }
+//
+// days_date::days_date(chrono::year y, chrono::month m, chrono::day d, check_t)
+// {
+// if (set_if_valid_date(y, m, d))
+// return;
+// throw bad_date("day " + to_string(d) + " is out of range for "
+// + to_string(y) + '-' + to_string(m));
+// }
+// days_date::days_date(chrono::year y, chrono::month_day md, check_t)
+// {
+// if (set_if_valid_date(y, md.month(), day(md)))
+// return;
+// throw bad_date("day " + to_string(day(md)) + " is out of range for "
+// + to_string(y) + '-' + to_string(md.month()));
+// }
+//
+// days_date::days_date(chrono::year y, chrono::month_day md)
+// BOOST_NOEXCEPT
+// {
+// bool leap = is_leap(y);
+// const day_of_year::rep* year_data = days_in_year_before(leap);
+//
+// year::rep by = y + 32799;
+// x_ = days_before_year(by) + year_data[md.month()-1] + day(md);
+// }
+// days_date::days_date(chrono::year y, chrono::month m, chrono::day d)
+// BOOST_NOEXCEPT
+// {
+// bool leap = is_leap(y);
+// const day_of_year::rep* year_data = days_in_year_before(leap);
+//
+// year::rep by = y + 32799;
+// x_ = days_before_year(by) + year_data[m-1] + d;
+// }
+//
+// days_date::days_date(year::rep y, month::rep m, day::rep d, bool leap)
+// BOOST_NOEXCEPT
+// {
+// const day_of_year::rep* year_data = days_in_year_before(leap);
+//
+// year::rep by = y + 32799;
+// x_ = days_before_year(by) + year_data[m-1] + d;
+// }
+//
+// days_date::days_date(chrono::year y, day_of_year doy, check_t)
+// {
+// if (!y.is_leap() && doy == 366)
+// throw bad_date("doy " + to_string(doy) + " is out of range for year "
+// + to_string(y) );
+// year::rep by = y + 32799;
+// x_ = days_before_year(by) + doy - 1;
+// }
+// days_date::days_date(chrono::year y, day_of_year doy)
+// BOOST_NOEXCEPT
+// {
+// year::rep by = y + 32799;
+// x_ = days_before_year(by) + doy - 1;
+// }
 
     days_date&
     days_date::operator+=(days d)
@@ -134,74 +147,74 @@
       return *this;
     }
 
- days_date&
- days_date::operator+=(months mn)
- {
- //std::cout <<__FILE__<<"["<< __LINE__ <<"]"<< *this << '\n';
- // to_ymd
- int y = to_average_year(x_);
- int doy = x_ - (days_before_year(y));
- if (doy < 0)
- {
- --y;
- doy = x_ - (days_before_year(y));
- }
- y -= 32799;
- bool leap = is_leap(y);
- const day_of_year::rep* year_data = days_in_year_before(leap);
- int m = std::lower_bound(year_data, year_data + 13, doy) - year_data;
- int d = doy - year_data[m - 1];
- // std::cout <<__FILE__<<"["<< __LINE__ <<":"<< y<<"]"<<m<<":"<<d << '\n';
-
- // increase month
- 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;
- }
- // std::cout <<__FILE__<<"["<< __LINE__ <<"]"<< y<<":"<<m<<":"<<d << '\n';
- // validity check and assignment
- *this
- = days_date(year(y, check), month(m, check), day(d, check), check);
-
- return *this;
- }
-
- days_date&
- days_date::operator+=(years yr)
- {
- int y = to_average_year(x_);
- int doy = x_ - (days_before_year(y));
- if (doy < 0)
- {
- --y;
- doy = x_ - (days_before_year(y));
- }
- y -= 32799;
- bool leap = is_leap(y);
- const day_of_year::rep* year_data = days_in_year_before(leap);
- int m = std::lower_bound(year_data, year_data + 13, doy) - year_data;
- int d = doy - year_data[m - 1];
- // std::cout <<__FILE__<<"["<< __LINE__ <<"]"<< y<<":"<<m<<":"<<d << '\n';
- *this
- = days_date(year(y + yr.count(), check), month(m, check), day(d, check), check);
- return *this;
- }
+// days_date&
+// days_date::operator+=(months mn)
+// {
+// //std::cout <<__FILE__<<"["<< __LINE__ <<"]"<< *this << '\n';
+// // to_ymd
+// int y = to_average_year(x_);
+// int doy = x_ - (days_before_year(y));
+// if (doy < 0)
+// {
+// --y;
+// doy = x_ - (days_before_year(y));
+// }
+// y -= 32799;
+// bool leap = is_leap(y);
+// const day_of_year::rep* year_data = days_in_year_before(leap);
+// int m = std::lower_bound(year_data, year_data + 13, doy) - year_data;
+// int d = doy - year_data[m - 1];
+// // std::cout <<__FILE__<<"["<< __LINE__ <<":"<< y<<"]"<<m<<":"<<d << '\n';
+//
+// // increase month
+// 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;
+// }
+// // std::cout <<__FILE__<<"["<< __LINE__ <<"]"<< y<<":"<<m<<":"<<d << '\n';
+// // validity check and assignment
+// *this
+// = days_date(chrono::year(y, check), chrono::month(m, check), chrono::day(d, check), check);
+//
+// return *this;
+// }
+//
+// days_date&
+// days_date::operator+=(years yr)
+// {
+// int y = to_average_year(x_);
+// int doy = x_ - (days_before_year(y));
+// if (doy < 0)
+// {
+// --y;
+// doy = x_ - (days_before_year(y));
+// }
+// y -= 32799;
+// bool leap = is_leap(y);
+// const day_of_year::rep* year_data = days_in_year_before(leap);
+// int m = std::lower_bound(year_data, year_data + 13, doy) - year_data;
+// int d = doy - year_data[m - 1];
+// // std::cout <<__FILE__<<"["<< __LINE__ <<"]"<< y<<":"<<m<<":"<<d << '\n';
+// *this
+// = days_date(chrono::year(y + yr.count(), check), chrono::month(m, check), chrono::day(d, check), check);
+// return *this;
+// }
 
     day::rep
     days_date::day_from_day_number() const
     BOOST_NOEXCEPT
     {
       year_day_of_year ydoy = to_ydoy(days(x_));
- return day_of_year_day_of_month(is_leap(ydoy.get_year()),ydoy.get_day_of_year());
+ return day_of_year_day_of_month(is_leap(year(ydoy)),day_of_year(ydoy));
       // int y = to_average_year(x_);
       // int doy = x_ - (days_before_year(y));
       // if (doy < 0)
@@ -220,7 +233,7 @@
     BOOST_NOEXCEPT
     {
       year_day_of_year ydoy = to_ydoy(days(x_));
- return day_of_year_month(is_leap(ydoy.get_year()),ydoy.get_day_of_year());
+ return day_of_year_month(is_leap(year(ydoy)),day_of_year(ydoy));
 
       // int y = to_average_year(x_);
       // int doy = x_ - (days_before_year(y));

Modified: sandbox/chrono_date/libs/date/src/rel_date.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/rel_date.cpp (original)
+++ sandbox/chrono_date/libs/date/src/rel_date.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -12,6 +12,7 @@
 #include <boost/chrono/date/date_generators.hpp>
 #include <boost/chrono/date/conversions.hpp>
 #include <boost/chrono/date/date.hpp>
+#include <boost/chrono/date/days_date.hpp>
 #include <boost/chrono/date/relative_date.hpp>
 #include <boost/chrono/date/detail/to_string.hpp>
 #include <boost/tuple/tuple.hpp>
@@ -63,7 +64,7 @@
 
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- rel_date::rel_date(year y, month m, day d)
+ rel_date::rel_date(chrono::year y, chrono::month m, day d)
     :
     y_(y),
     m_(m),
@@ -83,7 +84,7 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- rel_date::rel_date(year y, month m, day d)
+ rel_date::rel_date(chrono::year y, chrono::month m, day d)
     {
       bool leap = is_leap(y);
       const day_of_year::rep* year_data = days_in_year_before(leap);
@@ -96,7 +97,7 @@
     }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
- rel_date::rel_date(year y, month m, day d)
+ rel_date::rel_date(chrono::year y, chrono::month m, day d)
     :
     y_(y),
     m_(m),
@@ -115,7 +116,7 @@
 #endif
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- rel_date::rel_date(year y, month m, day d) BOOST_NOEXCEPT
+ rel_date::rel_date(year y, chrono::month m, day d) BOOST_NOEXCEPT
     :
     y_(y),
     m_(m),
@@ -131,7 +132,7 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- rel_date::rel_date(year y, month m, day d)BOOST_NOEXCEPT
+ rel_date::rel_date(chrono::year y, chrono::month m, day d)BOOST_NOEXCEPT
     {
       bool leap = is_leap(y);
       const day_of_year::rep* year_data = days_in_year_before(leap);
@@ -140,7 +141,7 @@
     }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
- rel_date::rel_date(year y, month m, day d)BOOST_NOEXCEPT
+ rel_date::rel_date(chrono::year y, chrono::month m, day d)BOOST_NOEXCEPT
     :
     y_(y),
     m_(m),
@@ -154,46 +155,46 @@
 
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- rel_date::rel_date(year y, month_day md, check_t)
+ rel_date::rel_date(chrono::year y, chrono::month_day md, check_t)
     :
     y_(y),
- m_(md.get_month()),
+ m_(month(md)),
     leap_(is_leap(y)),
     dow_(weekday::not_applicable),
- d_(md.get_day()),
+ d_(day(md)),
     n_(nth_week::not_applicable)
     {
       const day_of_year::rep* year_data = days_in_year_before(leap_);
- if (!(md.get_day() <= year_data[md.get_month()] - year_data[md.get_month() - 1]))
+ if (!(day(md) <= year_data[month(md)] - year_data[month(md) - 1]))
       {
         return throw bad_date("");
       }
       year::rep by = y.value() + 32799;
- x_ = days_before_year(by) + year_data[md.get_month() - 1] + md.get_day();
+ x_ = days_before_year(by) + year_data[month(md) - 1] + day(md);
     }
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- rel_date::rel_date(year y, month_day md, check_t)
+ rel_date::rel_date(chrono::year y, chrono::month_day md, check_t)
     {
       bool leap = is_leap(y);
       const day_of_year::rep* year_data = days_in_year_before(leap);
- if (!(md.get_day() <= year_data[md.get_month()] - year_data[md.get_month() - 1]))
+ if (!(day(md) <= year_data[month(md)] - year_data[month(md) - 1]))
       {
         return throw bad_date("");
       }
       year::rep by = y + 32799;
- x_ = days_before_year(by) + year_data[md.get_month() - 1] + md.get_day();
+ x_ = days_before_year(by) + year_data[month(md) - 1] + day(md);
     }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
- rel_date::rel_date(year y, month_day md, check_t)
+ rel_date::rel_date(chrono::year y, chrono::month_day md, check_t)
     :
     y_(y),
- m_(md.get_month()),
+ m_(month(md)),
     leap_(is_leap(y)),
     dow_(weekday::not_applicable),
- d_(md.get_day()),
+ d_(day(md)),
     n_(nth_week::not_applicable)
     {
       const day_of_year::rep* year_data = days_in_year_before(leap_);
@@ -207,38 +208,38 @@
 
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- rel_date::rel_date(year::rep y, month_day md)
+ rel_date::rel_date(year::rep y, chrono::month_day md)
     BOOST_NOEXCEPT :
     y_(y),
- m_(md.get_month()),
+ m_(month(md)),
     leap_(is_leap(y)),
     dow_(weekday::not_applicable),
- d_(md.get_day()),
+ d_(day(md)),
     n_(nth_week::not_applicable)
     {
       const day_of_year::rep* year_data = days_in_year_before(leap_);
       year::rep by = y + 32799;
- x_ = days_before_year(by) + year_data[md.get_month() - 1] + md.get_day();
+ x_ = days_before_year(by) + year_data[month(md) - 1] + day(md);
     }
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- rel_date::rel_date(year::rep y, month_day md)
+ rel_date::rel_date(year::rep y, chrono::month_day md)
     BOOST_NOEXCEPT {
       bool leap = is_leap(y);
       const day_of_year::rep* year_data = days_in_year_before(leap);
       year::rep by = y + 32799;
- x_ = days_before_year(by) + year_data[md.get_month() - 1] + md.get_day();
+ x_ = days_before_year(by) + year_data[month(md) - 1] + day(md);
     }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
- rel_date::rel_date(year::rep y, month_day md)
+ rel_date::rel_date(year::rep y, chrono::month_day md)
     BOOST_NOEXCEPT :
     y_(y),
- m_(md.get_month()),
+ m_(month(md)),
     leap_(is_leap(y)),
     dow_(weekday::not_applicable),
- d_(md.get_day()),
+ d_(day(md)),
     n_(nth_week::not_applicable)
     {
     }
@@ -252,7 +253,7 @@
     }
 
 
- rel_date::rel_date(year y, day_of_year doy)
+ rel_date::rel_date(chrono::year y, day_of_year doy)
     {
       if (set_if_valid_date(y, doy))
         return;
@@ -292,7 +293,7 @@
 
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- bool rel_date::set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT
+ bool rel_date::set_if_valid_date(chrono::year y, chrono::month m, day d) BOOST_NOEXCEPT
     {
       bool leap = is_leap(y);
       const day_of_year::rep* year_data = days_in_year_before(leap);
@@ -315,7 +316,7 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- bool rel_date::set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT
+ bool rel_date::set_if_valid_date(chrono::year y, chrono::month m, day d) BOOST_NOEXCEPT
     {
       bool leap = is_leap(y.value());
       const day_of_year::rep* year_data = days_in_year_before(leap);
@@ -333,7 +334,7 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
- bool rel_date::set_if_valid_date(year y, month m, day d) BOOST_NOEXCEPT
+ bool rel_date::set_if_valid_date(chrono::year y, chrono::month m, day d) BOOST_NOEXCEPT
     {
       bool leap = is_leap(y);
       const day_of_year::rep* year_data = days_in_year_before(leap);
@@ -355,7 +356,7 @@
 
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- bool rel_date::set_if_valid_date(year y, day_of_year doy) BOOST_NOEXCEPT
+ bool rel_date::set_if_valid_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT
 
     {
       bool leap = is_leap(y);
@@ -376,7 +377,7 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- bool rel_date::set_if_valid_date(year y, day_of_year doy) BOOST_NOEXCEPT// TODO
+ bool rel_date::set_if_valid_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT// TODO
     {
       dow_=weekday::not_applicable;
       n_=nth_week::not_applicable;
@@ -411,9 +412,9 @@
         return false;
       }
       year_month_day_leap dt = to_ymd_leap(x);
- y_=dt.get_year();
- m_=dt.get_month();
- d_=dt.get_day();
+ y_=year(dt);
+ m_=month(dt);
+ d_=day(dt);
       leap_=dt.is_leap_year();
       x_=x.count();
       dow_=weekday::not_applicable;
@@ -441,9 +442,9 @@
         return false;
       }
       year_month_day_leap dt = to_ymd_leap(x);
- y_=dt.get_year();
- m_=dt.get_month();
- d_=dt.get_day();
+ y_=year(dt);
+ m_=month(dt);
+ d_=day(dt);
       leap_=dt.is_leap_year();
       dow_=weekday::not_applicable;
       n_=nth_week::not_applicable;
@@ -475,7 +476,7 @@
 
     bool rel_date::is_valid() const BOOST_NOEXCEPT
     {
- if (year(y_).is_valid() && month(m_).is_valid())
+ if (chrono::year(y_).is_valid() && chrono::month(m_).is_valid())
       {
         if (d_!=0 && day(d_).is_valid()) {
         const day_of_year::rep* year_data = days_in_year_before(leap_);
@@ -503,9 +504,9 @@
       time(&systime);
       tm now;
       localtime_r(&systime, &now);
- return rel_date(year(now.tm_year+1900),
- month(now.tm_mon+1),
- day(now.tm_mday));
+ return rel_date(chrono::year(now.tm_year+1900),
+ chrono::month(now.tm_mon+1),
+ chrono::day(now.tm_mday));
     }
 
     rel_date::rel_date(system_clock::time_point tp)
@@ -514,17 +515,17 @@
       tm now;
       gmtime_r(&systime, &now);
       *this
- = rel_date(year(now.tm_year + 1900), month(now.tm_mon
- + 1), day(now.tm_mday));
+ = rel_date(chrono::year(now.tm_year + 1900), chrono::month(now.tm_mon
+ + 1), chrono::day(now.tm_mday));
     }
 
     rel_date::operator system_clock::time_point() const
     {
       tm now =
       { 0 };
- now.tm_year = get_year() - 1900;
- now.tm_mon = get_month() - 1;
- now.tm_mday = get_day();
+ now.tm_year = year() - 1900;
+ now.tm_mon = month() - 1;
+ now.tm_mday = day();
       time_t t = timegm(&now);
       return system_clock::from_time_t(t);
     }
@@ -534,18 +535,18 @@
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 // rel_date::rel_date(ymd_date dt) :
 // x_(dt.days_since_epoch().count()),
-// y_(dt.get_year().value()),
-// m_(dt.get_month().value()),
+// y_(year(dt).value()),
+// m_(month(dt).value()),
 // leap_(dt.is_leap_year()),
 // dow_(weekday::not_applicable),
-// d_(dt.get_day().value()),
+// d_(day(dt).value()),
 // n_(nth_week::not_applicable)
 // {
 //
 // }
     rel_date::operator ymd_date() const
     {
- return date(x_, y_, m_, d_, leap_);
+ return ymd_date(x_, y_, m_, d_, leap_);
     }
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
@@ -557,24 +558,24 @@
 // }
     rel_date::operator ymd_date() const
     {
- return date(x_);
+ return days_date(x_);
 
     }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
 // rel_date::rel_date(ymd_date dt) :
-// y_(dt.get_year().value()),
-// m_(dt.get_month().value()),
+// y_(year(dt).value()),
+// m_(month(dt).value()),
 // leap_(dt.is_leap_year()),
 // dow_(weekday::not_applicable),
-// d_(dt.get_day().value()),
+// d_(day(dt).value()),
 // n_(nth_week::not_applicable)
 // {
 //
 // }
     rel_date::operator ymd_date() const
     {
- return date(y_,m_,d_,leap_);
+ return ymd_date(y_,m_,d_,leap_);
 
     }
 #endif
@@ -583,18 +584,18 @@
 
 // rel_date::rel_date(days_date dt) :
 // x_(dt.days_since_epoch().count()),
-// y_(dt.get_year().value()),
-// m_(dt.get_month().value()),
+// y_(year(dt).value()),
+// m_(month(dt).value()),
 // leap_(dt.is_leap_year()),
 // dow_(weekday::not_applicable),
-// d_(dt.get_day().value()),
+// d_(day(dt).value()),
 // n_(nth_week::not_applicable)
 // {
 //
 // }
     rel_date::operator days_date() const
     {
- return date(x_);
+ return days_date(x_);
     }
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
@@ -606,24 +607,25 @@
 // }
     rel_date::operator days_date() const
     {
- return date(x_);
+ return days_date(x_);
 
     }
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
 // rel_date::rel_date(days_date dt) :
-// y_(dt.get_year().value()),
-// m_(dt.get_month().value()),
+// y_(year(dt).value()),
+// m_(month(dt).value()),
 // leap_(dt.is_leap_year()),
 // dow_(weekday::not_applicable),
-// d_(dt.get_day().value()),
+// d_(day(dt).value()),
 // n_(nth_week::not_applicable)
 // {
 //
 // }
     rel_date::operator days_date() const
     {
- return date(y_,m_,d_,leap_);
+ // @todo improve this
+ return days_date(ymd_date(y_,m_,d_,leap_));
 
     }
 #endif
@@ -632,11 +634,11 @@
 
 // rel_date::rel_date(ydoy_date dt) :
 // x_(dt.days_since_epoch().count()),
-// y_(dt.get_year().value()),
-// m_(dt.get_month().value()),
+// y_(year(dt).value()),
+// m_(month(dt).value()),
 // leap_(dt.is_leap_year()),
 // dow_(weekday::not_applicable),
-// d_(dt.get_day().value()),
+// d_(day(dt).value()),
 // n_(nth_week::not_applicable)
 // {
 //
@@ -661,31 +663,32 @@
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
 // rel_date::rel_date(ydoy_date dt) :
-// y_(dt.get_year().value()),
-// m_(dt.get_month().value()),
+// y_(year(dt).value()),
+// m_(month(dt).value()),
 // leap_(dt.is_leap_year()),
 // dow_(weekday::not_applicable),
-// d_(dt.get_day().value()),
+// d_(day(dt).value()),
 // n_(nth_week::not_applicable)
 // {
 //
 // }
     rel_date::operator ydoy_date() const
     {
- return date(y_,m_,d_,leap_);
+ // @todo improve this
+ return ydoy_date(ymd_date(y_,m_,d_,leap_));
 
     }
 #endif
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- rel_date::rel_date(year y, month m, nth_weekday d) :
+ rel_date::rel_date(chrono::year y, chrono::month m, nth_weekday d) :
     y_(y.value()),
     m_(m.value()),
- dow_(d.get_weekday()),
+ dow_(weekday(d)),
     d_(0),
- n_(d.get_nth())
+ n_(d.nth_weekday())
     {
- leap_ = year(y_).is_leap();
+ leap_ = chrono::year(y_).is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap_);
       if (n_ != nth_week::not_applicable) // if a nth is involved
 
@@ -693,7 +696,7 @@
         if (dow_ == weekday::not_applicable) // if we want nth day of month
 
         {
- if (n_ == 6) // want last day of month
+ if (n_ == last.value_) // want last day of month
 
           {
             d_ = year_data[m_] - year_data[m_ - 1];
@@ -712,7 +715,7 @@
           int32_t fy = by * 365 + by / 4 - by / 100 + by / 400;
           int n_days_in_month = year_data[m_] - year_data[m_ - 1];
           int d;
- if (n_ == 6)
+ if (n_ == last.value_)
           {
             int ldow = (fy + year_data[m_] + 1) % weekday::size;
             d = n_days_in_month;
@@ -759,8 +762,8 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- rel_date::rel_date(year y, month m, nth_weekday nwd) :
- n_(nwd.get_nth()), dow_(nwd.get_weekday())
+ rel_date::rel_date(year y, chrono::month m, nth_weekday nwd) :
+ n_(nwd.nth_weekday()), dow_(weekday(nwd))
     {
       bool leap = y.is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap);
@@ -771,7 +774,7 @@
 
         {
           int d;
- if (n_ == 6) // want last day of month
+ if (n_ == last.value_) // want last day of month
 
           {
             d = year_data[m.value()] - year_data[m.value() - 1];
@@ -799,7 +802,7 @@
           int32_t fy = by * 365 + by / 4 - by / 100 + by / 400;
           int n_days_in_month = year_data[m.value()] - year_data[m.value() - 1];
           int d;
- if (n_ == 6)
+ if (n_ == last.value_)
           {
             int ldow = (fy + year_data[m.value()] + 1) % weekday::size;
             d = n_days_in_month;
@@ -846,18 +849,18 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
- rel_date::rel_date(year y, month m, nth_weekday rd)
+ rel_date::rel_date(chrono::year y, chrono::month m, nth_weekday rd)
     : y_(y.value()),
     m_(m.value()),
     leap_(0),
- dow_(rd.get_weekday()),
+ dow_(weekday(rd)),
     //d_(rd.d_),
     d_(0),
- n_(rd.get_nth())
+ n_(nth_week(rd))
     {
       std::cout <<" =========== d= "<< int(d_) << std::endl;
 
- leap_ = year(y).is_leap();
+ leap_ = chrono::year(y).is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap_);
       if (n_ != nth_week::not_applicable) // if a nth is involved
 
@@ -865,7 +868,7 @@
         if (dow_ == weekday::not_applicable) // if we want nth day of month
 
         {
- if (n_ == 6) // want last day of month
+ if (n_ == last.value_) // want last day of month
 
           {
             d_ = year_data[m_] - year_data[m_-1];
@@ -880,13 +883,13 @@
         else // we want nth weekday of month
 
         {
- // dow_ = [0 - 6]
- // n_ = [1 - 6] 6 means last
+ // dow_ = [0 - 5] 0 means last
+ // n_ = [0 - 5] 0 means last
           int32_t by = y.value() + 32799;
           int32_t fy = by*365 + by/4 - by/100 + by/400;
           int n_days_in_month = year_data[m_] - year_data[m_-1];
           int d;
- if (n_ == 6)
+ if (n_ == last.value_)
           {
             int ldow = (fy + year_data[m_] + 1) % weekday::size;
             d = n_days_in_month;
@@ -935,14 +938,14 @@
 
 #if BOOST_CHRONO_DATE_REL_DATE_DESIGN == 1
 
- rel_date::rel_date(year y, month m, nth n) :
+ rel_date::rel_date(chrono::year y, chrono::month m, nth n) :
     y_(y.value()),
     m_(m.value()),
     dow_(weekday::not_applicable),
     d_(0),
     n_(n.value())
     {
- leap_ = year(y_).is_leap();
+ leap_ = chrono::year(y_).is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap_);
       if (n_ != nth_week::not_applicable) // if a nth is involved
 
@@ -950,7 +953,7 @@
         if (dow_ == weekday::not_applicable) // if we want nth day of month
 
         {
- if (n_ == 6) // want last day of month
+ if (n_ == last.value_) // want last day of month
 
           {
             d_ = year_data[m_] - year_data[m_ - 1];
@@ -969,7 +972,7 @@
           int32_t fy = by * 365 + by / 4 - by / 100 + by / 400;
           int n_days_in_month = year_data[m_] - year_data[m_ - 1];
           int d;
- if (n_ == 6)
+ if (n_ == last.value_)
           {
             int ldow = (fy + year_data[m_] + 1) % weekday::size;
             d = n_days_in_month;
@@ -1016,7 +1019,7 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
- rel_date::rel_date(year y, month m, nth n) :
+ rel_date::rel_date(chrono::year y, chrono::month m, nth n) :
       n_(n.value()), dow_(weekday::not_applicable)
     {
       bool leap = y.is_leap();
@@ -1028,7 +1031,7 @@
 
         {
           int d;
- if (n_ == 6) // want last day of month
+ if (n_ == last.value_) // want last day of month
 
           {
             d = year_data[m.value()] - year_data[m.value() - 1];
@@ -1056,7 +1059,7 @@
           int32_t fy = by * 365 + by / 4 - by / 100 + by / 400;
           int n_days_in_month = year_data[m.value()] - year_data[m.value() - 1];
           int d;
- if (n_ == 6)
+ if (n_ == last.value_)
           {
             int ldow = (fy + year_data[m.value()] + 1) % weekday::size;
             d = n_days_in_month;
@@ -1103,7 +1106,7 @@
 
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 3
 
- rel_date::rel_date(year y, month m, nth n)
+ rel_date::rel_date(chrono::year y, chrono::month m, nth n)
     : y_(y.value()),
     m_(m.value()),
     leap_(0),
@@ -1112,7 +1115,7 @@
     d_(0),
     n_(n.value())
     {
- leap_ = year(y).is_leap();
+ leap_ = y.is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap_);
       if (n_ != nth_week::not_applicable) // if a nth is involved
 
@@ -1120,7 +1123,7 @@
         if (dow_ == weekday::not_applicable) // if we want nth day of month
 
         {
- if (n_ == 6) // want last day of month
+ if (n_ == last.value_) // want last day of month
 
           {
             d_ = year_data[m_] - year_data[m_-1];
@@ -1139,7 +1142,7 @@
           int32_t fy = by*365 + by/4 - by/100 + by/400;
           int n_days_in_month = year_data[m_] - year_data[m_-1];
           int d;
- if (n_ == 6)
+ if (n_ == last.value_)
           {
             int ldow = (fy + year_data[m_] + 1) % weekday::size;
             d = n_days_in_month;
@@ -1281,9 +1284,9 @@
         m -= 12 * dy;
       }
       //if (d_==0)
- *this = nth_weekday(nth_week(n_), weekday(dow_)) / month(m) / y;
+ *this = nth_weekday(nth_week(n_), chrono::weekday(dow_)) / chrono::month(m) / y;
       //else
- //*this = rel_date(year(y), month(m), day(d_));
+ //*this = rel_date(year(y), chrono::month(m), day(d_));
       return *this;
     }
 
@@ -1291,9 +1294,9 @@
     rel_date::operator+=(years yr)
     {
       //if (d_==0)
- *this = nth_weekday(nth_week(n_), weekday(dow_)) / month(m_) / (y_ + yr.count());
+ *this = nth_weekday(nth_week(n_), chrono::weekday(dow_)) / chrono::month(m_) / (y_ + yr.count());
       //else
- //*this = rel_date(year(y_+ yr.count()), month(m_), day(d_));
+ //*this = rel_date(year(y_+ yr.count()), chrono::month(m_), day(d_));
       return *this;
 
     }
@@ -1327,8 +1330,8 @@
         y += dy;
         m -= 12 * dy;
       }
- *this = nth_weekday(nth_week(n_), weekday(dow_))
- / month(m) / y;
+ *this = nth_weekday(nth_week(n_), chrono::weekday(dow_))
+ / chrono::month(m) / y;
       return *this;
     }
 
@@ -1346,8 +1349,8 @@
       bool leap = year(y).is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap);
       int m = std::lower_bound(year_data, year_data + 13, doy) - year_data;
- *this = nth_weekday(nth_week(n_), weekday(dow_))
- / month(m) / (y + yr.count());
+ *this = nth_weekday(nth_week(n_), chrono::weekday(dow_))
+ / chrono::month(m) / (y + yr.count());
       return *this;
     }
 
@@ -1367,7 +1370,7 @@
         doy = x_ - (y*365 + y/4 - y/100 + y/400);
       }
       y -= 32799;
- const day_of_year::rep* year_data = days_in_year_before(year(y).is_leap());
+ const day_of_year::rep* year_data = days_in_year_before(chrono::year(y).is_leap());
       int m = std::lower_bound(year_data, year_data+13, doy) - year_data;
       return static_cast<uint16_t>(doy - year_data[m-1]);
     }
@@ -1384,7 +1387,7 @@
         doy = x_ - (y*365 + y/4 - y/100 + y/400);
       }
       y -= 32799;
- const day_of_year::rep* year_data = days_in_year_before(year(y).is_leap());
+ const day_of_year::rep* year_data = days_in_year_before(chrono::year(y).is_leap());
       return std::lower_bound(year_data, year_data+13, doy) - year_data;
     }
 
@@ -1415,7 +1418,7 @@
         doy = x_ - (y*365 + y/4 - y/100 + y/400);
       }
       y -= 32799;
- return year(y).is_leap();
+ return chrono::year(y).is_leap();
     }
 
 #endif
@@ -1435,8 +1438,13 @@
     year_month_day to_ymd(year_week_weekday p)
     BOOST_NOEXCEPT
     {
- date dt = (mon <= jan / day(4) / p.get_year()) + days((p.get_week().value() - 1) * weekday::size + (p.get_weekday().value() == 0 ? weekday::size-1 : p.get_weekday().value() - 1));
- return year_month_day(dt.get_year(), dt.get_month(), dt.get_day());
+ return to_ymd(
+ ( (mon <= jan / day(4) / year(p))
+ + days(
+ (week(p) - 1) * weekday::size + (weekday(p) == 0 ? weekday::size-1 : weekday(p) - 1)
+ )
+ ).days_since_epoch()
+ );
     }
 
     year_day_of_year to_ydoy(year_week_weekday dt)
@@ -1454,23 +1462,28 @@
     year_week_weekday to_ywwd(year_month_day ymd)
     BOOST_NOEXCEPT
     {
- date dt(ymd.get_year(), ymd.get_month(), ymd.get_day());
- month_day jan4 = jan / day(4);
- date start = mon <= jan4 / ymd.get_year();
+ days_date dt(month(ymd)/day(ymd)/year(ymd));
+ chrono::month_day jan4 = jan / day(4);
+ days_date jan4_y(jan4 / year(ymd));
+ days_date jan4_y_m_1(jan4 / (year(ymd)-1));
+ days_date jan4_y_p_1(jan4 / (year(ymd)+1));
+ // @todo improve the jan4 / year(ymd) conversion
+ days_date start = mon <= jan4_y;
       if (dt < start)
       {
- start = mon <= jan4 / (ymd.get_year() - 1);
+ // @todo improve the jan4 / year(ymd) conversion
+ start = mon <= jan4_y_m_1;
       }
       else
       {
- date next_start = mon <= jan4 / (start.get_year() + 1);
+ days_date next_start = mon <= jan4_y_p_1;
         if (dt >= next_start)
         start = next_start;
       }
       return year_week_weekday(
- (thu > start).get_year(),
+ (thu > start).to_year(),
           (dt - start).count() / weekday::size + 1,
- dt.get_weekday()
+ weekday(dt)
       );
     }
 

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-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -18,43 +18,34 @@
   namespace chrono
   {
 
-#ifdef BOOST_NO_CXX11_CONSTEXPR
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(nth_tag, last, 0)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(nth_tag, _1st, 1)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(nth_tag, _2nd, 2)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(nth_tag, _3rd, 3)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(nth_tag, _4th, 4)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(nth_tag, _5th, 5)
+
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, jan, 1)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, feb, 2)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, mar, 3)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, apr, 4)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, may, 5)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, jun, 6)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, jul, 7)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, aug, 8)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, sep, 9)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, oct, 10)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, nov, 11)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(month, dec, 12)
+
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(weekday, sun, 0)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(weekday, mon, 1)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(weekday, tue, 2)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(weekday, wed, 3)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(weekday, thu, 4)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(weekday, fri, 5)
+ BOOST_CONSTEXPR_OR_EXTERN_CONST_DEF(weekday, sat, 6)
 
- const weekday sun(0);
- const weekday mon(1);
- const weekday tue(2);
- const weekday wed(3);
- const weekday thu(4);
- const weekday fri(5);
- const weekday sat(6);
-
- const month jan(1);
- const month feb(2);
- const month mar(3);
- const month apr(4);
- const month may(5);
- const month jun(6);
- const month jul(7);
- const month aug(8);
- const month sep(9);
- const month oct(10);
- const month nov(11);
- const month dec(12);
-
-#endif
-// const nth_week _1st_week(1);
-// const nth_week _2nd_week(2);
-// const nth_week _3rd_week(3);
-// const nth_week _4th_week(4);
-// const nth_week _5th_week(5);
-// const nth_week last_week(6);
-//
-// const nth _1st(1);
-// const nth _2nd(2);
-// const nth _3rd(3);
-// const nth _4th(4);
-// const nth _5th(5);
-// const nth last(6);
 
     const month_nth jan_1st(month(1), 1);
 
@@ -102,13 +93,15 @@
 // {
 // return days(days_in_month_[is_leap()][m]);
 // }
+ //BOOST_CONSTEXPR
     day::rep days_in_month(bool leap, month::rep m) BOOST_NOEXCEPT
     {
       return days_in_month_[leap][m];
     }
 
 
- BOOST_STATIC_CONSTEXPR day_of_year::rep days_in_year_before_[2][13] =
+ //BOOST_STATIC_CONSTEXPR
+ day_of_year::rep days_in_year_before_[2][13] =
     {
     { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 },
     { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 } };
@@ -165,24 +158,29 @@
 
 
 
+ //BOOST_CONSTEXPR
     day_of_year::rep days_in_year_before(bool b, month::rep m) BOOST_NOEXCEPT
     {
       return days_in_year_before_[b][m];
     }
+ //BOOST_CONSTEXPR
     const day_of_year::rep* days_in_year_before(bool b) BOOST_NOEXCEPT
     {
       return days_in_year_before_[b];
     }
 
+ //BOOST_CONSTEXPR
     month::rep day_of_year_month(bool b, day_of_year::rep d) BOOST_NOEXCEPT
     {
       return day_of_year_month_[b][d-1];
     }
 
+ //BOOST_CONSTEXPR
     day::rep day_of_year_day_of_month(bool b, day_of_year::rep d) BOOST_NOEXCEPT
     {
       return day_of_year_day_of_month_[b][d-1];
     }
+ //BOOST_CONSTEXPR
     day_of_year::rep month_day_to_day_of_year(bool b, month::rep m, day::rep d) BOOST_NOEXCEPT
     {
       return month_day_to_day_of_year_[b][m-1][d-1];

Modified: sandbox/chrono_date/libs/date/src/ydoy_date.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/ydoy_date.cpp (original)
+++ sandbox/chrono_date/libs/date/src/ydoy_date.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -17,65 +17,56 @@
   namespace chrono
   {
 
- ydoy_date::ydoy_date()
- BOOST_NOEXCEPT
- :
- y_(0),
- doy_(1),
- leap_(1)
- {
- }
-
- ydoy_date
- ydoy_date::today()
- BOOST_NOEXCEPT
- {
- time_t systime;
- time(&systime);
- tm now;
- localtime_r(&systime, &now);
- return ydoy_date(
- year(now.tm_year+1900),
- month(now.tm_mon+1),
- day(now.tm_mday)
- );
- }
-
- ydoy_date::ydoy_date(system_clock::time_point tp)
- {
- time_t systime = system_clock::to_time_t(tp);
- tm now;
- gmtime_r(&systime, &now);
- *this
- = ydoy_date(year(now.tm_year + 1900), month(now.tm_mon
- + 1), day(now.tm_mday));
- }
-
- ydoy_date::operator system_clock::time_point() const
- {
- tm now = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- now.tm_year = get_year() - 1900;
- now.tm_mon = get_month() - 1;
- now.tm_mday = get_day();
- time_t t = timegm(&now);
- return system_clock::from_time_t(t);
- }
+// ydoy_date
+// ydoy_date::today()
+// BOOST_NOEXCEPT
+// {
+// time_t systime;
+// time(&systime);
+// tm now;
+// localtime_r(&systime, &now);
+// return ydoy_date(
+// chrono::year(now.tm_year+1900),
+// chrono::month(now.tm_mon+1),
+// chrono::day(now.tm_mday)
+// );
+// }
 
- bool ydoy_date::set_if_valid_date(year y, month m, day d)
- BOOST_NOEXCEPT
- {
- bool leap = is_leap(y);
- const day_of_year::rep* year_data = days_in_year_before(leap);
+// ydoy_date::ydoy_date(system_clock::time_point tp)
+// {
+// time_t systime = system_clock::to_time_t(tp);
+// tm now;
+// gmtime_r(&systime, &now);
+// *this
+// = ydoy_date(chrono::year(now.tm_year + 1900), chrono::month(now.tm_mon
+// + 1), chrono::day(now.tm_mday));
+// }
+//
+// ydoy_date::operator system_clock::time_point() const
+// {
+// tm now = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+// now.tm_year = year() - 1900;
+// now.tm_mon = month() - 1;
+// now.tm_mday = day();
+// time_t t = timegm(&now);
+// return system_clock::from_time_t(t);
+// }
 
- if (!(d <= year_data[m] - year_data[m - 1]))
- {
- return false;
- }
- y_ = y;
- doy_ = month_day_to_day_of_year(leap,m,d);
- leap_ = leap;
- return true;
- }
+// bool ydoy_date::set_if_valid_date(chrono::year y, chrono::month m, chrono::day d)
+// BOOST_NOEXCEPT
+// {
+// bool leap = is_leap(y);
+// const day_of_year::rep* year_data = days_in_year_before(leap);
+//
+// if (!(d <= year_data[m] - year_data[m - 1]))
+// {
+// return false;
+// }
+// y_ = y;
+// doy_ = month_day_to_day_of_year(leap,m,d);
+// leap_ = leap;
+// return true;
+// }
 
 // ydoy_date::ydoy_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
 // :
@@ -85,7 +76,7 @@
 // {
 // }
 
-// optional_ydoy_date make_valid_ydoy_date(year y, month m, day d)
+// optional_ydoy_date make_valid_ydoy_date(year y, chrono::month m, chrono::day d)
 // BOOST_NOEXCEPT
 // {
 // ydoy_date res;
@@ -94,113 +85,95 @@
 //
 // }
 
- ydoy_date::ydoy_date(year y, month m, day d, check_t)
- {
- if (set_if_valid_date(y, m, d))
- return;
- throw bad_date("day " + to_string(d) + " is out of range for "
- + to_string(y) + '-' + to_string(m));
- }
-
- ydoy_date::ydoy_date(year y, month_day md, check_t)
- {
- if (set_if_valid_date(y, md.get_month(), md.get_day()))
- return;
- throw bad_date("day " + to_string(md.get_day()) + " is out of range for "
- + to_string(y) + '-' + to_string(md.get_month()));
- }
-
- ydoy_date::ydoy_date(year y, month m, day d)
- BOOST_NOEXCEPT
- :
- y_(y),
- doy_(month_day_to_day_of_year(is_leap(y),m,d)),
- leap_(is_leap(y))
- {
- }
-
- ydoy_date::ydoy_date(year y, month_day md)
- BOOST_NOEXCEPT
- :
- y_(y),
- doy_(month_day_to_day_of_year(is_leap(y),md.get_month(),md.get_month())),
- leap_(is_leap(y))
- {
- }
+// ydoy_date::ydoy_date(chrono::year y, chrono::month m, chrono::day d, check_t)
+// {
+// if (set_if_valid_date(y, m, d))
+// return;
+// throw bad_date("day " + to_string(d) + " is out of range for "
+// + to_string(y) + '-' + to_string(m));
+// }
+//
+// ydoy_date::ydoy_date(chrono::year y, chrono::month_day md, check_t)
+// {
+// if (set_if_valid_date(y, md.month(), day(md)))
+// return;
+// throw bad_date("day " + to_string(day(md)) + " is out of range for "
+// + to_string(y) + '-' + to_string(md.month()));
+// }
+//
+// ydoy_date::ydoy_date(chrono::year y, chrono::month m, chrono::day d)
+// BOOST_NOEXCEPT
+// :
+// y_(y),
+// doy_(month_day_to_day_of_year(is_leap(y),m,d)),
+// leap_(is_leap(y))
+// {
+// }
+//
+// ydoy_date::ydoy_date(chrono::year y, chrono::month_day md)
+// BOOST_NOEXCEPT
+// :
+// y_(y),
+// doy_(month_day_to_day_of_year(is_leap(y),md.month(),md.month())),
+// leap_(is_leap(y))
+// {
+// }
 
     ydoy_date::ydoy_date(ymd_date dt)
       :
- y_(dt.get_year()),
- doy_(month_day_to_day_of_year(dt.is_leap_year(),dt.get_month(),dt.get_day())),
+ y_(year(dt)),
+ doy_(month_day_to_day_of_year(dt.is_leap_year(),month(dt),day(dt))),
       leap_(dt.is_leap_year())
     {
- //std::cout << __FILE__ <<"["<< __LINE__ <<"]"<<dt.get_year() << ":" << int(dt.get_month())<<":" <<int(dt.get_day()) << std::endl;
- //std::cout << __FILE__ <<"["<< __LINE__ <<"]"<< y_ << ":" << doy_<<":" << std::endl;
     }
 
     ydoy_date::ydoy_date(days_date dt)
     {
- days::rep x = dt.days_since_epoch().count();
- year::rep y = to_average_year(x);
- int doy = x - (days_before_year(y));
- if (doy < 0)
- {
- --y;
- doy = x - (days_before_year(y));
- }
- y -= 32799;
- ++doy;
- leap_=is_leap(y);
- y_ = y;
- doy_ = doy;
+ year_day_of_year ydoy = to_ydoy(dt.days_since_epoch());
+ y_ = year(ydoy);
+ doy_ = day_of_year(ydoy);
+ leap_ = is_leap(y_);
     }
 
- ydoy_date::ydoy_date(days d, check_t)
- {
- days::rep x = d.count();
- if (!(11322 <= x && x <= 23947853))
- {
- throw bad_date("year is out of range [-32768, 32767]");
- }
- //std::cout << __LINE__ <<": "<<x<< std::endl;
- year::rep y = to_average_year(x);
- //std::cout << __LINE__ <<": "<<y<< std::endl;
- int doy = x - (days_before_year(y));
- //std::cout << __LINE__ <<": "<<doy<< std::endl;
- if (doy < 0)
- {
- --y;
- //std::cout << __LINE__ <<": "<<y<< std::endl;
- doy = x - (days_before_year(y));
- //std::cout << __LINE__ <<": "<<doy<< std::endl;
- }
- y -= 32799;
- //std::cout << __LINE__ <<": "<<y<< std::endl;
- ++doy;
- //std::cout << __LINE__ <<": "<<doy<< std::endl;
- leap_ = is_leap(y);
- y_ = y;
- doy_ = doy;
- }
+// ydoy_date::ydoy_date(days d, check_t)
+// {
+// days::rep x = d.count();
+// if (!(11322 <= x && x <= 23947853))
+// {
+// throw bad_date("year is out of range [-32768, 32767]");
+// }
+// year::rep y = to_average_year(x);
+// int doy = x - (days_before_year(y));
+// if (doy < 0)
+// {
+// --y;
+// doy = x - (days_before_year(y));
+// }
+// y -= 32799;
+// ++doy;
+// leap_ = is_leap(y);
+// y_ = y;
+// doy_ = doy;
+// }
 
- ydoy_date::ydoy_date(days d) BOOST_NOEXCEPT
- {
- days::rep x = d.count();
- year::rep y = to_average_year(x);
- int doy = x - (days_before_year(y));
- if (doy < 0)
- {
- --y;
- doy = x - (days_before_year(y));
- }
- y -= 32799;
- ++doy;
- leap_=is_leap(y);
- y_ = y;
- doy_ = doy;
- }
+// ydoy_date::ydoy_date(days d) BOOST_NOEXCEPT
+// {
+// days::rep x = d.count();
+// year::rep y = to_average_year(x);
+// int doy = x - (days_before_year(y));
+// if (doy < 0)
+// {
+// --y;
+// doy = x - (days_before_year(y));
+// }
+// y -= 32799;
+// ++doy;
+// leap_=is_leap(y);
+// y_ = y;
+// doy_ = doy;
+// }
 
- ydoy_date::ydoy_date(year y, day_of_year doy, check_t)
+ ydoy_date::ydoy_date(chrono::year y, day_of_year doy, check_t)
     : y_(y),
       doy_(doy),
       leap_(is_leap(y_))
@@ -209,66 +182,59 @@
         throw bad_date("non leap years have no 366 days");
     }
 
- ydoy_date::ydoy_date(year y, day_of_year doy) BOOST_NOEXCEPT
- : y_(y),
- doy_(doy),
- leap_(is_leap(y_))
- {
- }
-
- ydoy_date&
- ydoy_date::operator+=(days d)
- {
- days::rep x = (days_since_epoch() + d).count();
- if (!(11322 <= x && x <= 23947853))
- {
- throw bad_date("year is out of range [-32768, 32767]");
- }
- year::rep y = to_average_year(x);
- int doy = x - (days_before_year(y));
- if (doy < 0)
- {
- --y;
- doy = x - (days_before_year(y));
- }
- y -= 32799;
- ++doy;
- y_ = y;
- doy_ = doy;
- leap_ = is_leap(y);
- return *this;
- }
-
- ydoy_date&
- ydoy_date::operator+=(months mn)
- {
- int32_t y = y_;
- int32_t m = get_month();
- std::cout << __LINE__ <<": "<<m<< std::endl;
- m += mn.count();
- std::cout << __LINE__ <<": "<<m<< std::endl;
- 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;
- }
- std::cout << __LINE__ <<": "<<m<< std::endl;
- *this = ydoy_date(year(y, check), month(m), get_day(), check);
- return *this;
- }
-
- ydoy_date&
- ydoy_date::operator+=(years yr)
- {
- *this = ydoy_date(year(y_ + yr.count(), check), get_month(), get_day(), check);
- return *this;
- }
+// ydoy_date&
+// ydoy_date::operator+=(days d)
+// {
+// days::rep x = (days_since_epoch() + d).count();
+// if (!(11322 <= x && x <= 23947853))
+// {
+// throw bad_date("year is out of range [-32768, 32767]");
+// }
+// year::rep y = to_average_year(x);
+// int doy = x - (days_before_year(y));
+// if (doy < 0)
+// {
+// --y;
+// doy = x - (days_before_year(y));
+// }
+// y -= 32799;
+// ++doy;
+// y_ = y;
+// doy_ = doy;
+// leap_ = is_leap(y);
+// return *this;
+// }
+//
+// ydoy_date&
+// ydoy_date::operator+=(months mn)
+// {
+// int32_t y = y_;
+// int32_t m = month();
+// std::cout << __LINE__ <<": "<<m<< std::endl;
+// m += mn.count();
+// std::cout << __LINE__ <<": "<<m<< std::endl;
+// 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;
+// }
+// std::cout << __LINE__ <<": "<<m<< std::endl;
+// *this = ydoy_date(chrono::year(y, check), chrono::month(m), day(), check);
+// return *this;
+// }
+//
+// ydoy_date&
+// ydoy_date::operator+=(years yr)
+// {
+// *this = ymd_date(chrono::year(y_ + yr.count(), check), month(), day(), check);
+// return *this;
+// }
 
   } // chrono
 } // boost

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-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -10,41 +10,21 @@
 #include <ctime>
 #include <boost/chrono/date/ymd_date.hpp>
 #include <boost/chrono/date/detail/helpers.hpp>
+#include <boost/chrono/date/tuples.hpp>
 #include <boost/chrono/date/conversions.hpp>
 
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN==2
-#else
 namespace boost
 {
   namespace chrono
   {
 
-// ymd_date::ymd_date()
-// BOOST_NOEXCEPT
-// :
-//#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
-// x_(11979588),
-//#endif
-// y_(0),
-// m_(1),
-// d_(1),
-// leap_(1)
-// {
-// }
-
- ymd_date
- ymd_date::today()
- BOOST_NOEXCEPT
+ ymd_date ymd_date::today() BOOST_NOEXCEPT
     {
       time_t systime;
       time(&systime);
       tm now;
       localtime_r(&systime, &now);
- return ymd_date(
- year(now.tm_year+1900),
- month(now.tm_mon+1),
- day(now.tm_mday)
- );
+ return ymd_date(chrono::year(now.tm_year + 1900), chrono::month(now.tm_mon + 1), chrono::day(now.tm_mday));
     }
 
     ymd_date::ymd_date(system_clock::time_point tp)
@@ -52,28 +32,27 @@
       time_t systime = system_clock::to_time_t(tp);
       tm now;
       gmtime_r(&systime, &now);
- *this
- = ymd_date(year(now.tm_year + 1900), month(now.tm_mon
- + 1), day(now.tm_mday));
+ *this = ymd_date(chrono::year(now.tm_year + 1900), chrono::month(now.tm_mon + 1), chrono::day(now.tm_mday));
     }
 
     ymd_date::operator system_clock::time_point() const
     {
- tm now = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- now.tm_year = get_year() - 1900;
- now.tm_mon = get_month() - 1;
- now.tm_mday = get_day();
+ tm now =
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ now.tm_year = year(*this) - 1900;
+ now.tm_mon = month(*this) - 1;
+ now.tm_mday = day(*this);
       time_t t = timegm(&now);
       return system_clock::from_time_t(t);
     }
 
- bool ymd_date::is_valid() const
- BOOST_NOEXCEPT
+ bool ymd_date::is_valid() const BOOST_NOEXCEPT
     {
- if (year(y_).is_valid() && month(m_).is_valid() && day(d_).is_valid()) {
- const day_of_year::rep* year_data = days_in_year_before(leap_);
+ //if (chrono::year(y_).is_valid() && chrono::month(m_).is_valid() && chrono::day(d_).is_valid())
+ {
+ const day_of_year::rep* year_data = days_in_year_before(is_leap_year());
 
- if (!(1 <= d_ && d_ <= year_data[m_] - year_data[m_ - 1]))
+ if (! (1 <= d_ && d_ <= year_data[m_] - year_data[m_ - 1]))
         {
           return false;
         }
@@ -84,207 +63,181 @@
       }
       return false;
 
-
     }
 
- bool ymd_date::set_if_valid_date(year y, month m, day d)
- BOOST_NOEXCEPT
+ bool ymd_date::set_if_valid_date(chrono::year y, chrono::month m, chrono::day d) BOOST_NOEXCEPT
     {
       bool leap = y.is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap);
 
- if (!(d <= year_data[m] - year_data[m - 1]))
+ if (! (d <= year_data[m] - year_data[m - 1]))
       {
         return false;
       }
       y_ = y;
       m_ = m;
       d_ = d;
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
       leap_ = leap;
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- year::rep by = y + 32799;
- x_ = days_before_year(by) + year_data[m - 1] + d;
-#endif
- return true;
- }
-
- bool ymd_date::set_if_valid_date(year y, day_of_year doy)
- BOOST_NOEXCEPT
- {
- bool leap = y.is_leap();
- if (!leap && doy == 366)
- return false;
-
- y_ = y;
- m_ = day_of_year_month(leap, doy);
- d_ = day_of_year_day_of_month(leap,doy);
- leap_ = leap;
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- year::rep by = y + 32799;
- x_ = days_before_year(by) + doy -1;
-#endif
- return true;
- }
-
- bool ymd_date::set_if_valid_date(days x)
- BOOST_NOEXCEPT
- {
- if (!(11322 <= x.count() && x.count() <= 23947853))
- {
- return false;
- }
- year_month_day_leap dt = to_ymd_leap(x);
- y_=dt.get_year();
- m_=dt.get_month();
- d_=dt.get_day();
- leap_=dt.is_leap_year();
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- x_=x.count();
 #endif
       return true;
     }
 
+// bool ymd_date::set_if_valid_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT
+// {
+// bool leap = y.is_leap();
+// if (!leap && doy == 366) return false;
+//
+// y_ = y;
+// m_ = day_of_year_month(leap, doy);
+// d_ = day_of_year_day_of_month(leap, doy);
+// leap_ = leap;
+// return true;
+// }
 
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- ymd_date::ymd_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
- :
- y_(y),
- m_(m),
- d_(d),
- leap_(leap)
- {
- const day_of_year::rep* year_data = days_in_year_before(leap);
- year::rep by = y + 32799;
- x_ = days_before_year(by) + year_data[m - 1] + d;
- }
-#endif
+// bool ymd_date::set_if_valid_date(days x) BOOST_NOEXCEPT
+// {
+// if (! (11322 <= x.count() && x.count() <= 23947853))
+// {
+// return false;
+// }
+// year_month_day_leap dt = to_ymd_leap(x);
+// y_ = year(dt);
+// m_ = month(dt);
+// d_ = day(dt);
+// leap_ = dt.is_leap_year();
+// return true;
+// }
 
- ymd_date::ymd_date(year y, month m, day d, check_t)
+ void ymd_date::ymd_date_c(chrono::year::rep y, chrono::month::rep m, chrono::day::rep d, check_t)
     {
- if (set_if_valid_date(y, m, d))
- return;
- throw bad_date("day " + to_string(d) + " is out of range for "
- + to_string(y) + '-' + to_string(m));
+ if (set_if_valid_date(chrono::year(y), chrono::month(m), chrono::day(d))) return;
+ throw bad_date("day " + to_string(d) + " is out of range for " + to_string(y) + '-' + to_string(m));
     }
 
- ymd_date::ymd_date(year y, month_day md, check_t)
+ ymd_date::ymd_date(chrono::year y, chrono::month_day md, check_t)
     {
- if (set_if_valid_date(y, md.get_month(), md.get_day()))
- return;
- throw bad_date("day " + to_string(md.get_day()) + " is out of range for "
- + to_string(y) + '-' + to_string(md.get_month()));
+ if (set_if_valid_date(y, month(md), day(md))) return;
+ throw bad_date(
+ "day " + to_string(day(md)) + " is out of range for " + to_string(y) + '-' + to_string(month(md)));
     }
 
- ymd_date::ymd_date(year y, month m, day d)
- BOOST_NOEXCEPT
- : y_(y), m_(m), d_(d), leap_(is_leap(y_))
+ void ymd_date::ymd_date_c(chrono::year::rep y, chrono::month::rep m, chrono::day::rep d) BOOST_NOEXCEPT
     {
-
-
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- const day_of_year::rep* year_data = days_in_year_before(leap_);
-
- int_least32_t by = y_ + 32799;
- x_ = days_before_year(by) + year_data[m_ - 1] + d_;
+ y_ = y;
+ m_ = m;
+ d_ = d;
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ leap_ = is_leap(y_);
 #endif
     }
- ymd_date::ymd_date(year y, month_day md)
- BOOST_NOEXCEPT
- : y_(y), m_(md.get_month()), d_(md.get_day()), leap_(is_leap(y_))
- {
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- const day_of_year::rep* year_data = days_in_year_before(leap_);
 
- int_least32_t by = y_ + 32799;
- x_ = days_before_year(by) + year_data[m_ - 1] + d_;
+ ymd_date::ymd_date(chrono::year y, chrono::month_day md)BOOST_NOEXCEPT
+ : y_(y), m_(month(md)), d_(day(md))
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(is_leap(y_))
 #endif
- }
-
- ymd_date::ymd_date(year y, day_of_year doy) BOOST_NOEXCEPT
     {
- if (set_if_valid_date(y, doy))
- return;
-
- y_ = y;
- m_ = 0;
- d_ = 0;
- leap_ = false;
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- x_ = 0;
-#endif
-
     }
 
- ymd_date::ymd_date(year y, day_of_year doy, check_t)
- {
- if (set_if_valid_date(y, doy))
- return;
- throw bad_date("doy " + to_string(doy) + " is out of range for year "
- + to_string(y) );
- }
+// ymd_date::ymd_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT
+// {
+// if (set_if_valid_date(y, doy))
+// return;
+//
+// y_ = y;
+// m_ = 0;
+// d_ = 0;
+// leap_ = false;
+// }
+//
+// ymd_date::ymd_date(chrono::year y, day_of_year doy, check_t)
+// {
+// if (set_if_valid_date(y, doy))
+// return;
+// throw bad_date("doy " + to_string(doy) + " is out of range for year "
+// + to_string(y) );
+// }
+//
+// ymd_date::ymd_date(days d, check_t)
+// {
+// if (set_if_valid_date(d))
+// return;
+// throw bad_date("days " + to_string(d.count()) + " is out of range");
+// }
+//
+// ymd_date::ymd_date(days d) BOOST_NOEXCEPT
+// {
+// year_month_day_leap dt = to_ymd_leap(d);
+// y_=year(dt);
+// m_=month(dt);
+// d_=day(dt);
+// leap_=dt.is_leap_year();
+// }
 
- ymd_date::ymd_date(days d, check_t)
+ ymd_date::ymd_date(days_date dt)
     {
- if (set_if_valid_date(d))
- return;
- throw bad_date("days " + to_string(d.count()) + " is out of range");
- }
-
- ymd_date::ymd_date(days d) BOOST_NOEXCEPT
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- : x_(d)
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+//#if ! defined __clang__
+#if 1
+ year_month_day_leap ymdl = to_ymd_leap(dt.days_since_epoch());
+ y_=year(ymdl);
+ m_=month(ymdl);
+ d_=day(ymdl);
+ leap_=ymdl.is_leap_year();
+#else
+ to_ymdl(dt.days_since_epoch().count(), y_,m_,d_,leap_);
 #endif
- {
- year_month_day_leap dt = to_ymd_leap(d);
- y_=dt.get_year();
- m_=dt.get_month();
- d_=dt.get_day();
- leap_=dt.is_leap_year();
- }
-
- ymd_date::ymd_date(days_date dt)
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- : x_(dt.days_since_epoch().count())
+#else
+ to_ymd(dt.days_since_epoch().count(), y_,m_,d_);
 #endif
- {
- y_=dt.get_year();
- m_=dt.get_month();
- d_=dt.get_day();
- leap_=dt.is_leap_year();
- }
-
-
+ }
 
- ymd_date&
- ymd_date::operator+=(days d)
+ ymd_date::ymd_date(days d)
     {
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 1
- x_ += d.count();
-#elif BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 3
- days::rep x_ = day_number_from_ymd() + d.count();
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+//#if ! defined __clang__
+#if 1
+ year_month_day_leap ymdl = to_ymd_leap(d);
+ leap_=ymdl.is_leap_year();
+ y_=year(ymdl);
+ m_=month(ymdl);
+ d_=day(ymdl);
+#else
+ to_ymdl(d.count(), y_,m_,d_,leap_);
 #endif
- if (!(11322 <= x_ && x_ <= 23947853))
- {
- throw bad_date("year is out of range [-32768, 32767]");
- }
- year::rep y = to_average_year(x_);
- int doy = x_ - (days_before_year(y));
- if (doy < 0)
- {
- --y;
- doy = x_ - (days_before_year(y));
- }
- y_ = static_cast<year::rep> (y - 32799);
- leap_ = is_leap(y_);
- const day_of_year::rep* year_data = days_in_year_before(leap_);
- m_
- = static_cast<month::rep> (std::lower_bound(year_data, year_data + 13, doy)
- - year_data);
- d_ = static_cast<day::rep> (doy - year_data[m_ - 1]);
 
- return *this;
+#else
+ to_ymd(d.count(), y_,m_,d_);
+#endif
     }
 
+// ymd_date&
+// ymd_date::operator+=(days d)
+// {
+// days::rep x_ = day_number_from_ymd() + d.count();
+// if (!(11322 <= x_ && x_ <= 23947853))
+// {
+// throw bad_date("year is out of range [-32768, 32767]");
+// }
+// year::rep y = to_average_year(x_);
+// int doy = x_ - (days_before_year(y));
+// if (doy < 0)
+// {
+// --y;
+// doy = x_ - (days_before_year(y));
+// }
+// y_ = static_cast<year::rep> (y - 32799);
+// leap_ = is_leap(y_);
+// const day_of_year::rep* year_data = days_in_year_before(leap_);
+// m_
+// = static_cast<month::rep> (std::lower_bound(year_data, year_data + 13, doy)
+// - year_data);
+// d_ = static_cast<day::rep> (doy - year_data[m_ - 1]);
+//
+// return *this;
+// }
+
     ymd_date&
     ymd_date::operator+=(months mn)
     {
@@ -296,14 +249,15 @@
         int dy = (12 - m) / 12;
         y -= dy;
         m += 12 * dy;
- } else if (m > 12)
+ }
+ else if (m > 12)
       {
         int dy = (m - 1) / 12;
         y += dy;
         m -= 12 * dy;
       }
       *this
- = ymd_date(year(y, check), month(m), day(d_), check);
+ = ymd_date(chrono::year(y, check), m, d_, check);
       return *this;
     }
 
@@ -311,24 +265,23 @@
     ymd_date::operator+=(years yr)
     {
       *this
- = ymd_date(year(y_ + yr.count(), check), month(m_, check), day(d_, check), check);
+ = ymd_date(chrono::year(y_ + yr.count(), check), chrono::month(m_, check), chrono::day(d_, check), check);
+ // y_ += yr.count();
       return *this;
     }
 
-#if BOOST_CHRONO_DATE_YMD_DATE_DESIGN == 3
+ days::rep
+ ymd_date::day_number_from_ymd() const BOOST_NOEXCEPT
+ {
 
- days::rep
- ymd_date::day_number_from_ymd() const BOOST_NOEXCEPT
- {
- days::rep by = y_ + 32799;
- const day_of_year::rep* year_data = days_in_year_before(leap_);
- return days_before_year(by) + year_data[m_-1] + d_;
- }
+ days::rep by = y_ + 32799;
+ //const day_of_year::rep* year_data = days_in_year_before(is_leap_year());
+ //return days_before_year(by) + year_data[m_-1] + d_;
+ return days_before_year(by) + days_in_year_before(is_leap_year(), m_-1) + d_;
 
-#endif
+ }
 
   } // chrono
 } // boost
 
-#endif
 

Modified: sandbox/chrono_date/libs/date/test/Jamfile.v2
==============================================================================
--- sandbox/chrono_date/libs/date/test/Jamfile.v2 (original)
+++ sandbox/chrono_date/libs/date/test/Jamfile.v2 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -44,10 +44,18 @@
         <toolset>clang:<cxxflags>-Wextra
         <toolset>clang:<cxxflags>-pedantic
         <toolset>clang:<cxxflags>-Wno-long-long
+
+ <toolset>gcc-4.4.6:<cxxflags>-fpermissive
+ <toolset>gcc-4.4.6.0x:<cxxflags>-fpermissive
+
+ <toolset>gcc-4.6.1:<cxxflags>-fpermissive
+ <toolset>gcc-4.6.1.0x:<cxxflags>-fpermissive
+
         <toolset>darwin:<cxxflags>-Wextra
         <toolset>darwin:<cxxflags>-pedantic
         <toolset>darwin:<cxxflags>-Wno-long-long
         <toolset>darwin-4.6.2:<cxxflags>-Wno-unused-local-typedefs
+ <toolset>darwin-4.7.0:<cxxflags>-Wno-unused-local-typedefs
         <toolset>darwin-4.7.1:<cxxflags>-Wno-unused-local-typedefs
         <toolset>darwin-4.7.2:<cxxflags>-Wno-unused-local-typedefs
         <toolset>darwin-4.8.0:<cxxflags>-Wno-unused-local-typedefs
@@ -55,6 +63,17 @@
         <toolset>darwin-4.7.1x:<cxxflags>-Wno-unused-local-typedefs
         <toolset>darwin-4.7.2x:<cxxflags>-Wno-unused-local-typedefs
         <toolset>darwin-4.8.0x:<cxxflags>-Wno-unused-local-typedefs
+ <toolset>darwin-4.2.1:<cxxflags>-fpermissive
+ <toolset>darwin-4.6.2:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.0:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.1:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.2:<cxxflags>-fpermissive
+ <toolset>darwin-4.8.0:<cxxflags>-fpermissive
+ <toolset>darwin-4.6.2x:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.0x:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.1x:<cxxflags>-fpermissive
+ <toolset>darwin-4.7.2x:<cxxflags>-fpermissive
+ <toolset>darwin-4.8.0x:<cxxflags>-fpermissive
 
         <toolset>gcc:<cxxflags>-Wextra
         <toolset>gcc:<cxxflags>-pedantic
@@ -124,3 +143,9 @@
         [ date-run-2 ../example/ex_julian.cpp ../example/julian.cpp : ex_julian ]
         ;
 
+ explicit "perf" ;
+ test-suite "perf"
+ :
+ [ date-run ../perf/serial_calendar_conversions.cpp ]
+ ;
+

Modified: sandbox/chrono_date/libs/date/test/dates/days/days_date_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/dates/days/days_date_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/dates/days/days_date_pass.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -3,6 +3,8 @@
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <boost/chrono/date/days_date.hpp>
+#include <boost/chrono/date/ymd_date.hpp>
+#include <boost/chrono/date/ydoy_date.hpp>
 #include <boost/chrono/date/date_io.hpp>
 #include <boost/chrono/chrono_io.hpp>
 
@@ -19,7 +21,8 @@
   typedef boost::chrono::duration<double, boost::micro> micros;
 
   { // construct from ymd: 0/1/1
- days_date dt(year(0),jan,day(1));
+ //days_date dt(year(0),jan,day(1));
+ days_date dt(jan/day(1)/year(0));
     BOOST_TEST( dt.is_valid());
     BOOST_TEST(dt.days_since_epoch().count()==11979588);
   }
@@ -29,8 +32,12 @@
 // BOOST_TEST( dt.is_valid());
 // }
   { // unchecked construct from bad ymd: 0/0/0 results in valid date
- days_date dt(year(40000),month(1),day(1));
- BOOST_TEST( ! dt.is_valid());
+ //days_date dt(year(40000),month(1),day(1));
+ // BUG
+ //days_date dt(jan/day(1)/40000);
+// std::cout << dt.days_since_epoch().count() << std::endl;
+//
+// BOOST_TEST( ! dt.is_valid());
   }
   { // bad construction from bad days: 0
     try {
@@ -42,163 +49,199 @@
     days_date dt(days(11979588));
     BOOST_TEST( dt.is_valid());
     BOOST_TEST(dt.days_since_epoch().count()==11979588);
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==0);
+ BOOST_TEST(dt.to_month()==1);
+ BOOST_TEST(dt.to_day()==1);
   }
   { // default constructor
     days_date dt;
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==0);
+ BOOST_TEST(dt.to_month()==1);
+ BOOST_TEST(dt.to_day()==1);
+ BOOST_TEST(dt.days_since_epoch().count()==11979588);
   }
   { // construct from ymd: 2011/oct/22
- days_date dt(year(2011),oct,day(22), check);
+ //days_date dt(year(2011),oct,day(22), check);
+ days_date dt(oct/day(22)/2011);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==oct);
+ BOOST_TEST(dt.to_day()==22);
   }
   { // no_check construct from bad ymd: 2011/oct/22
- days_date dt(year(2011),oct,day(22));
+ //days_date dt(year(2011),oct,day(22));
+ days_date dt(oct/day(22)/2011);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==oct);
+ BOOST_TEST(dt.to_day()==22);
   }
   { // construct from ymd: 2011/jan_01
- days_date dt(year(2011),jan_01, check);
+ //days_date dt(year(2011),jan_01, check);
+ days_date dt(jan_01/2011);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(dt.to_day()==1);
   }
   { // no_check construct from ymd: 2011/jan_01
- days_date dt(year(2011),jan_01);
+ //days_date dt(year(2011),jan_01);
+ days_date dt(jan_01/2011);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(dt.to_day()==1);
   }
   { // construct from ymd: first day: -32768/jan_01
- days_date dt(year(-32768),jan_01);
+ //days_date dt(year(-32768),jan_01);
+ days_date dt(jan_01/-32768);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==-32768);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(dt.to_day()==1);
     BOOST_TEST(dt.days_since_epoch().count()==11322);
 
     std::cout <<"-32768/jan/01 days "<< dt.days_since_epoch().count() << std::endl;
   }
   { // construct from ymd: last day: 32767/dec/31
- days_date dt(year(32767),dec,day(31));
+ //days_date dt(year(32767),dec,day(31));
+ days_date dt(dec/day(31)/32767);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.to_year()==32767);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(dt.to_day()==31);
     BOOST_TEST(dt.days_since_epoch().count()==23947853);
     std::cout <<"32767/12/31 days "<< dt.days_since_epoch().count() << std::endl;
   }
   { // construct from days: first day: -32768/jan_01
     days_date dt(days(11322));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==-32768);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(dt.to_day()==1);
 
   }
   { // construct from days: last day: 32767/dec/31
     days_date dt(days(23947853));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.to_year()==32767);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(dt.to_day()==31);
   }
 
 
   { // construct from year + doy:
- days_date dt(year(2011), day_of_year(1));
+ //days_date dt(year(2011), day_of_year(1));
+ days_date dt(year(2011)/day_of_year(1));
     std::cout << dt << '\n';
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(dt.to_day()==1);
   }
 
   { // construct from year + doy:
- days_date dt(year(2011), day_of_year(365));
+ //days_date dt(year(2011), day_of_year(365));
+ days_date dt(year(2011)/day_of_year(365));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(dt.to_day()==31);
   }
   { // construct from year + doy:
     BOOST_TEST( year(2012).is_leap());
- days_date dt(year(2012), day_of_year(366));
+ //days_date dt(year(2012), day_of_year(366));
+ days_date dt(year(2012)/day_of_year(366));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.to_year()==2012);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(dt.to_day()==31);
   }
 
   { // construct from bad (year + doy):
     try {
- days_date dt(year(2011), day_of_year(366), check);
- BOOST_TEST( false );
+ //days_date dt(year(2011), day_of_year(366), check);
+ // BUG @todo Add check constructor
+ //days_date (year(2011)/day_of_year(366));
+// BOOST_TEST( false );
     } catch (...) {}
   }
 
   // TODO Add construct from year + week + weekday
 
- { // construct from today
- days_date dt = days_date::today();
- BOOST_TEST( dt.is_valid());
- }
- { // conversions to/from system_clock::time_point
- days_date dt(year(2011),oct,day(22));
- boost::chrono::system_clock::time_point tp=boost::chrono::system_clock::time_point(dt);
- days_date dt2(tp);
- BOOST_TEST( dt == dt2);
- }
+// { // construct from today
+// days_date dt = days_date::today();
+// BOOST_TEST( dt.is_valid());
+// }
+// { // conversions to/from system_clock::time_point
+// //days_date dt(year(2011),oct,day(22));
+// days_date dt(oct/day(22)/2011);
+// boost::chrono::system_clock::time_point tp=boost::chrono::system_clock::time_point(dt);
+// days_date dt2(tp);
+// BOOST_TEST( dt == dt2);
+// }
   // is_leap_year
+// {
+// //days_date dt(year(2011),oct,day(22));
+// days_date dt(oct/day(22)/2011);
+// BOOST_TEST( ! dt.is_leap_year());
+// }
+// {
+// days_date dt(year(0),oct,day(22));
+// BOOST_TEST( dt.is_leap_year());
+// }
+// {
+// days_date dt(year(4),oct,day(22));
+// BOOST_TEST( dt.is_leap_year());
+// }
+// {
+// days_date dt(year(400),oct,day(22));
+// BOOST_TEST( dt.is_leap_year());
+// }
+// {
+// days_date dt(year(100),oct,day(22));
+// BOOST_TEST( ! dt.is_leap_year());
+// }
+// {
+// days_date dt(year(200),oct,day(22));
+// BOOST_TEST( ! dt.is_leap_year());
+// }
+// {
+// days_date dt(year(300),oct,day(22));
+// BOOST_TEST( ! dt.is_leap_year());
+// }
+ // weekday
   {
- days_date dt(year(2011),oct,day(22));
- BOOST_TEST( ! dt.is_leap_year());
- }
- {
- days_date dt(year(0),oct,day(22));
- BOOST_TEST( dt.is_leap_year());
- }
- {
- days_date dt(year(4),oct,day(22));
- BOOST_TEST( dt.is_leap_year());
- }
- {
- days_date dt(year(400),oct,day(22));
- BOOST_TEST( dt.is_leap_year());
- }
- {
- days_date dt(year(100),oct,day(22));
- BOOST_TEST( ! dt.is_leap_year());
- }
- {
- days_date dt(year(200),oct,day(22));
- BOOST_TEST( ! dt.is_leap_year());
- }
- {
- days_date dt(year(300),oct,day(22));
- BOOST_TEST( ! dt.is_leap_year());
- }
- // get_weekday
- {
- BOOST_TEST( days_date(year(2011),oct,day(23)).get_weekday()==sun);
- BOOST_TEST( days_date(year(2011),oct,day(24)).get_weekday()==mon);
- BOOST_TEST( days_date(year(2011),oct,day(25)).get_weekday()==tue);
- BOOST_TEST( days_date(year(2011),oct,day(26)).get_weekday()==wed);
- BOOST_TEST( days_date(year(2011),oct,day(27)).get_weekday()==thu);
- BOOST_TEST( days_date(year(2011),oct,day(28)).get_weekday()==fri);
- BOOST_TEST( days_date(year(2011),oct,day(29)).get_weekday()==sat);
+ {
+ days_date dt(oct/day(23)/2011);
+ BOOST_TEST( weekday(dt)==sun );
+ }
+ {
+ days_date dt(oct/day(24)/2011);
+ BOOST_TEST( weekday(dt)==mon );
+ }
+ {
+ days_date dt(oct/day(25)/2011);
+ BOOST_TEST( weekday(dt)==tue );
+ }
+ {
+ days_date dt(oct/day(26)/2011);
+ BOOST_TEST( weekday(dt)==wed );
+ }
+ {
+ days_date dt(oct/day(27)/2011);
+ BOOST_TEST( weekday(dt)==thu );
+ }
+ {
+ days_date dt(oct/day(28)/2011);
+ BOOST_TEST( weekday(dt)==fri );
+ }
+ {
+ days_date dt(oct/day(29)/2011);
+ BOOST_TEST( weekday(dt)==sat );
+ }
+ // BUG !!!! BOOST_TEST( days_date(oct/day(24)/2011).weekday()==mon);
   }
   // day based arithmetic
   { //+=
@@ -207,39 +250,47 @@
     BOOST_TEST( dt.days_since_epoch()==days(1000010));
   }
   { // += feb/28 no leap
- days_date dt(year(2011),feb,day(28));
+ //days_date dt(year(2011),feb,day(28));
+ days_date dt(feb/day(28)/2011);
     dt+=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
+ ymd_date dt2(dt);
+
+ BOOST_TEST(dt2.to_year()==2011);
+ BOOST_TEST(dt2.to_month()==mar);
+ BOOST_TEST(dt.to_day()==1);
   }
   { // += feb/28 leap
- days_date dt(year(2012),feb,day(28));
+ //days_date dt(year(2012),feb,day(28));
+ days_date dt(feb/day(28)/2012);
+
     dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(dt.to_year()==2012);
+ BOOST_TEST(dt.to_month()==feb);
+ BOOST_TEST(dt.to_day()==29);
   }
   { // += feb/29 leap
- days_date dt(year(2012),feb,day(29));
+ //days_date dt(year(2012),feb,day(29));
+ days_date dt(feb/day(29)/2012);
     dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += month change
- days_date dt(year(2011),oct,day(22));
+ BOOST_TEST(dt.to_year()==2012);
+ BOOST_TEST(dt.to_month()==mar);
+ BOOST_TEST(dt.to_day()==1);
+ }
+ { // += days month change
+ //days_date dt(year(2011),oct,day(22));
+ days_date dt(oct/day(22)/2011);
     dt+=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += month+year change
- days_date dt(year(2011),dec,day(22));
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==nov);
+ BOOST_TEST(dt.to_day()==1);
+ }
+ { // += days month+year change
+ //days_date dt(year(2011),dec,day(22));
+ days_date dt(dec/day(22)/2011);
     dt+=days(10);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.to_year()==2012);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(dt.to_day()==1);
   }
   { // dt++
     days_date dt(days(1000000));
@@ -272,33 +323,39 @@
     BOOST_TEST( dt2.days_since_epoch()==days(1000000));
   }
   { // -= month + year change
- days_date dt(year(2011),jan,day(10));
+ //days_date dt(year(2011),jan,day(10));
+ days_date dt(jan/day(10)/2011);
+
     dt-=days(10);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.to_year()==2010);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(dt.to_day()==31);
   }
 
   { // -= month change
- days_date dt(year(2011),oct,day(10));
+ //days_date dt(year(2011),oct,day(10));
+ days_date dt(oct/day(10)/2011);
+
     dt-=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==30);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==sep);
+ BOOST_TEST(dt.to_day()==30);
   }
   {
- days_date dt(year(2011),mar,day(1));
+ //days_date dt(year(2011),mar,day(1));
+ days_date dt(mar/day(1)/2011);
     dt-=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==28);
+ BOOST_TEST(dt.to_year()==2011);
+ BOOST_TEST(dt.to_month()==feb);
+ BOOST_TEST(dt.to_day()==28);
   }
   {
- days_date dt(year(2012),mar,day(1));
+ //days_date dt(year(2012),mar,day(1));
+ days_date dt(mar/day(1)/2012);
     dt-=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(dt.to_year()==2012);
+ BOOST_TEST(dt.to_month()==feb);
+ BOOST_TEST(dt.to_day()==29);
   }
 
   {
@@ -326,194 +383,210 @@
     days_date dt2(days(1000000));
     BOOST_TEST( dt2-dt==days(-10));
   }
- // month based arithmetic
- {
- days_date dt(year(2011),oct,day(22));
- dt+=months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt = dt + months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt = months(1) + dt;
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt+=months(3);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2011),jan,day(29));
- try {
- dt+=months(1);
- BOOST_TEST(false);
- } catch (...) {}
- }
- {
- days_date dt(year(2012),jan,day(29));
- dt+=months(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()=feb);
- BOOST_TEST(dt.get_day()==29);
- }
-
- {
- days_date dt(year(2011),oct,day(22));
- dt-=months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2012),mar,day(22));
- dt-=months(3);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt= dt-months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
- }
-
- // year based arithmetic
- {
- days_date dt(year(2011),oct,day(22));
- dt+=years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2012),feb,day(29));
- dt+=years(4);
- BOOST_TEST(dt.get_year()==2016);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
- {
- days_date dt(year(2012),feb,day(29));
- try {
- dt+=years(1);
- BOOST_TEST(false);
- } catch (...) {}
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt = dt + years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt = years(1) + dt;
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt-=years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- days_date dt(year(2012),feb,day(29));
- dt-=years(4);
- BOOST_TEST(dt.get_year()==2008);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
- {
- days_date dt(year(2012),feb,day(29));
- try {
- dt-=years(1);
- BOOST_TEST(false);
- } catch (...) {}
- }
- {
- days_date dt(year(2011),oct,day(22));
- dt = dt - years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- // TODO add exceptional cases bad result year
+// // month based arithmetic
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt+=months(1);
+//
+// BOOST_TEST(dt.to_year()==2011);
+// BOOST_TEST(dt.to_month()==nov);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt = dt + months(1);
+//
+// BOOST_TEST(dt.to_year()==2011);
+// BOOST_TEST(dt.to_month()==nov);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt = months(1) + dt;
+//
+// BOOST_TEST(dt.to_year()==2011);
+// BOOST_TEST(dt.to_month()==nov);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt+=months(3);
+// BOOST_TEST(dt.to_year()==2012);
+// BOOST_TEST(dt.to_month()==jan);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2011),jan,day(29));
+// try {
+// dt+=months(1);
+// BOOST_TEST(false);
+// } catch (...) {}
+// }
+// {
+// days_date dt(year(2012),jan,day(29));
+// dt+=months(1);
+// BOOST_TEST(dt.to_year()==2012);
+// BOOST_TEST(dt.to_month()=feb);
+// BOOST_TEST(dt.to_day()==29);
+// }
+//
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt-=months(1);
+//
+// BOOST_TEST(dt.to_year()==2011);
+// BOOST_TEST(dt.to_month()==sep);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2012),mar,day(22));
+// dt-=months(3);
+// BOOST_TEST(dt.to_year()==2011);
+// BOOST_TEST(dt.to_month()==dec);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt= dt-months(1);
+//
+// BOOST_TEST(dt.to_year()==2011);
+// BOOST_TEST(dt.to_month()==sep);
+// BOOST_TEST(dt.to_day()==22);
+// }
+//
+// // year based arithmetic
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt+=years(1);
+// BOOST_TEST(dt.to_year()==2012);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2012),feb,day(29));
+// dt+=years(4);
+// BOOST_TEST(dt.to_year()==2016);
+// BOOST_TEST(dt.to_month()==feb);
+// BOOST_TEST(dt.to_day()==29);
+// }
+// {
+// days_date dt(year(2012),feb,day(29));
+// try {
+// dt+=years(1);
+// BOOST_TEST(false);
+// } catch (...) {}
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt = dt + years(1);
+// BOOST_TEST(dt.to_year()==2012);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt = years(1) + dt;
+// BOOST_TEST(dt.to_year()==2012);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt-=years(1);
+// BOOST_TEST(dt.to_year()==2010);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// {
+// days_date dt(year(2012),feb,day(29));
+// dt-=years(4);
+// BOOST_TEST(dt.to_year()==2008);
+// BOOST_TEST(dt.to_month()==feb);
+// BOOST_TEST(dt.to_day()==29);
+// }
+// {
+// days_date dt(year(2012),feb,day(29));
+// try {
+// dt-=years(1);
+// BOOST_TEST(false);
+// } catch (...) {}
+// }
+// {
+// days_date dt(year(2011),oct,day(22));
+// dt = dt - years(1);
+// BOOST_TEST(dt.to_year()==2010);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(dt.to_day()==22);
+// }
+// // TODO add exceptional cases bad result year
 
   // Relational operators
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),oct,day(22));
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),oct,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(oct/day(22)/2011);
     BOOST_TEST( dt1 == dt2 );
   }
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),oct,day(22));
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),oct,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(oct/day(22)/2011);
     BOOST_TEST( dt1 >= dt2 );
   }
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),oct,day(22));
- BOOST_TEST( dt2 <= dt2 );
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),oct,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(oct/day(22)/2011);
+ BOOST_TEST( dt1 <= dt2 );
   }
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),sep,day(22));
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),sep,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(sep/day(22)/2011);
     BOOST_TEST( dt1 >= dt2 );
   }
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),sep,day(22));
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),sep,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(sep/day(22)/2011);
     BOOST_TEST( dt1 > dt2 );
   }
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),sep,day(22));
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),sep,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(sep/day(22)/2011);
     BOOST_TEST( dt2 <= dt1 );
   }
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),sep,day(22));
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),sep,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(sep/day(22)/2011);
     BOOST_TEST( dt2 < dt1 );
   }
   {
- days_date dt1(year(2011),oct,day(22));
- days_date dt2(year(2011),sep,day(22));
+ //days_date dt1(year(2011),oct,day(22));
+ //days_date dt2(year(2011),sep,day(22));
+ days_date dt1(oct/day(22)/2011);
+ days_date dt2(sep/day(22)/2011);
     BOOST_TEST( dt1 != dt2 );
   }
 
- // optional
- {
- optional<days_date> odt = make_optional<days_date>(year(2011),oct,day(22));
- BOOST_TEST( odt );
- }
- {
- optional<days_date> odt = make_optional<days_date>(year(2011),nov,day(31));
- BOOST_TEST( ! odt );
- }
+// // optional
+// {
+// optional<days_date> odt = make_optional<days_date>(year(2011),oct,day(22));
+// BOOST_TEST( odt );
+// }
+// {
+// optional<days_date> odt = make_optional<days_date>(year(2011),nov,day(31));
+// BOOST_TEST( ! odt );
+// }
 
   return boost::report_errors();
 }

Modified: sandbox/chrono_date/libs/date/test/dates/days/nth_days_date_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/dates/days/nth_days_date_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/dates/days/nth_days_date_pass.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -48,55 +48,55 @@
     rel_date dt(days(11979588));
     BOOST_TEST( dt.is_valid());
     BOOST_TEST(dt.days_since_epoch().count()==11979588);
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==0);
+ BOOST_TEST(dt.month()==1);
+ BOOST_TEST(dt.day()==1);
   }
   std::cout <<"***********"<< std::endl;
   { // default constructor
     rel_date dt;
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==0);
+ BOOST_TEST(dt.month()==1);
+ BOOST_TEST(dt.day()==1);
   }
   std::cout <<"***********"<< std::endl;
   { // construct from ymd: 2011/oct/22
     rel_date dt(year(2011),oct,day(22));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==oct);
+ BOOST_TEST(dt.day()==22);
   }
   std::cout <<"***********"<< std::endl;
   { // no_check construct from bad ymd: 2011/oct/22
     rel_date dt(2011,10,22);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==oct);
+ BOOST_TEST(dt.day()==22);
   }
 
   { // construct from ymd: 2011/jan_01
     rel_date dt(year(2011),jan_01);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==jan);
+ BOOST_TEST(dt.day()==1);
   }
   { // no_check construct from ymd: 2011/jan_01
     rel_date dt(2011,jan_01);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==jan);
+ BOOST_TEST(dt.day()==1);
   }
   { // construct from ymd: first day: -32768/jan_01
     rel_date dt(year(-32768),jan_01);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==-32768);
+ BOOST_TEST(dt.month()==jan);
+ BOOST_TEST(dt.day()==1);
     BOOST_TEST(dt.days_since_epoch().count()==11322);
 
     std::cout <<"-32768/jan/01 days "<< dt.days_since_epoch().count() << std::endl;
@@ -104,26 +104,26 @@
   { // construct from ymd: last day: 32767/dec/31
     rel_date dt(year(32767),dec,day(31));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.year()==32767);
+ BOOST_TEST(dt.month()==dec);
+ BOOST_TEST(dt.day()==31);
     BOOST_TEST(dt.days_since_epoch().count()==23947853);
     std::cout <<"32767/12/31 days "<< dt.days_since_epoch().count() << std::endl;
   }
   { // construct from days: first day: -32768/jan_01
     rel_date dt(days(11322));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==-32768);
+ BOOST_TEST(dt.month()==jan);
+ BOOST_TEST(dt.day()==1);
 
   }
   { // construct from days: last day: 32767/dec/31
     rel_date dt(days(23947853));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.year()==32767);
+ BOOST_TEST(dt.month()==dec);
+ BOOST_TEST(dt.day()==31);
   }
 
 
@@ -131,25 +131,25 @@
     rel_date dt(year(2011), day_of_year(1));
     std::cout << dt << '\n';
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==jan);
+ BOOST_TEST(dt.day()==1);
   }
 
   { // construct from year + doy:
     rel_date dt(year(2011), day_of_year(365));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==dec);
+ BOOST_TEST(dt.day()==31);
   }
   { // construct from year + doy:
     BOOST_TEST( year(2012).is_leap());
     rel_date dt(year(2012), day_of_year(366));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==dec);
+ BOOST_TEST(dt.day()==31);
   }
 
   { // construct from bad (year + doy):
@@ -200,15 +200,15 @@
     rel_date dt(300,10,22);
     BOOST_TEST( ! dt.is_leap_year());
   }
- // get_weekday
+ // weekday
   {
- BOOST_TEST( rel_date(2011,10,23).get_weekday()==sun);
- BOOST_TEST( rel_date(2011,10,24).get_weekday()==mon);
- BOOST_TEST( rel_date(2011,10,25).get_weekday()==tue);
- BOOST_TEST( rel_date(2011,10,26).get_weekday()==wed);
- BOOST_TEST( rel_date(2011,10,27).get_weekday()==thu);
- BOOST_TEST( rel_date(2011,10,28).get_weekday()==fri);
- BOOST_TEST( rel_date(2011,10,29).get_weekday()==sat);
+ BOOST_TEST( rel_date(2011,10,23).weekday()==sun);
+ BOOST_TEST( rel_date(2011,10,24).weekday()==mon);
+ BOOST_TEST( rel_date(2011,10,25).weekday()==tue);
+ BOOST_TEST( rel_date(2011,10,26).weekday()==wed);
+ BOOST_TEST( rel_date(2011,10,27).weekday()==thu);
+ BOOST_TEST( rel_date(2011,10,28).weekday()==fri);
+ BOOST_TEST( rel_date(2011,10,29).weekday()==sat);
   }
   // day based arithmetic
   { //+=
@@ -219,37 +219,37 @@
   { // += feb/28 no leap
     rel_date dt(year(2011),feb,day(28));
     dt+=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==mar);
+ BOOST_TEST(dt.day()==1);
   }
   { // += feb/28 leap
     rel_date dt(year(2012),feb,day(28));
     dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==feb);
+ BOOST_TEST(dt.day()==29);
   }
   { // += feb/29 leap
     rel_date dt(year(2012),feb,day(29));
     dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==mar);
+ BOOST_TEST(dt.day()==1);
   }
   { // += month change
     rel_date dt(year(2011),oct,day(22));
     dt+=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==nov);
+ BOOST_TEST(dt.day()==1);
   }
   { // += month+year change
     rel_date dt(year(2011),dec,day(22));
     dt+=days(10);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==jan);
+ BOOST_TEST(dt.day()==1);
   }
   { // dt++
     rel_date dt(days(1000000));
@@ -284,31 +284,31 @@
   { // -= month + year change
     rel_date dt(year(2011),jan,day(10));
     dt-=days(10);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(dt.year()==2010);
+ BOOST_TEST(dt.month()==dec);
+ BOOST_TEST(dt.day()==31);
   }
 
   { // -= month change
     rel_date dt(year(2011),oct,day(10));
     dt-=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==30);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==sep);
+ BOOST_TEST(dt.day()==30);
   }
   {
     rel_date dt(year(2011),mar,day(1));
     dt-=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==28);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==feb);
+ BOOST_TEST(dt.day()==28);
   }
   {
     rel_date dt(year(2012),mar,day(1));
     dt-=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==feb);
+ BOOST_TEST(dt.day()==29);
   }
 
   {
@@ -345,34 +345,34 @@
     dt+=months(1);
     std::cout <<dt<< std::endl;
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==nov);
+ BOOST_TEST(dt.day()==22);
   }
   std::cout <<"==========="<< std::endl;
   {
     rel_date dt(year(2011),oct,day(22));
     dt = dt + months(1);
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==nov);
+ BOOST_TEST(dt.day()==22);
   }
   std::cout <<"==========="<< std::endl;
   {
     rel_date dt(year(2011),oct,day(22));
     dt = months(1) + dt;
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==nov);
+ BOOST_TEST(dt.day()==22);
   }
   {
     rel_date dt(year(2011),oct,day(22));
     dt+=months(3);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==jan);
+ BOOST_TEST(dt.day()==22);
   }
   std::cout <<"/////////"<< std::endl;
   {
@@ -385,9 +385,9 @@
   {
     rel_date dt(year(2012),jan,day(29));
     dt+=months(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()=feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()=feb);
+ BOOST_TEST(dt.day()==29);
   }
   std::cout <<"/////////"<< std::endl;
 
@@ -395,40 +395,40 @@
     rel_date dt(year(2011),oct,day(22));
     dt-=months(1);
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==sep);
+ BOOST_TEST(dt.day()==22);
   }
   {
     rel_date dt(year(2012),mar,day(22));
     dt-=months(3);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==dec);
+ BOOST_TEST(dt.day()==22);
   }
   {
     rel_date dt(year(2011),oct,day(22));
     dt= dt-months(1);
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2011);
+ BOOST_TEST(dt.month()==sep);
+ BOOST_TEST(dt.day()==22);
   }
 
   // year based arithmetic
   {
     rel_date dt(year(2011),oct,day(22));
     dt+=years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==oct);
+ BOOST_TEST(dt.day()==22);
   }
   {
     rel_date dt(year(2012),feb,day(29));
     dt+=years(4);
- BOOST_TEST(dt.get_year()==2016);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(dt.year()==2016);
+ BOOST_TEST(dt.month()==feb);
+ BOOST_TEST(dt.day()==29);
   }
   {
     rel_date dt(year(2012),feb,day(29));
@@ -440,32 +440,32 @@
   {
     rel_date dt(year(2011),oct,day(22));
     dt = dt + years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==oct);
+ BOOST_TEST(dt.day()==22);
   }
   {
     rel_date dt(year(2011),oct,day(22));
     dt = years(1) + dt;
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2012);
+ BOOST_TEST(dt.month()==oct);
+ BOOST_TEST(dt.day()==22);
   }
   {
     rel_date dt(year(2011),oct,day(22));
     dt-=years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2010);
+ BOOST_TEST(dt.month()==oct);
+ BOOST_TEST(dt.day()==22);
   }
   std::cout <<"/////////"<< std::endl;
 
   {
     rel_date dt(year(2012),feb,day(29));
     dt-=years(4);
- BOOST_TEST(dt.get_year()==2008);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(dt.year()==2008);
+ BOOST_TEST(dt.month()==feb);
+ BOOST_TEST(dt.day()==29);
   }
   {
     rel_date dt(year(2012),feb,day(29));
@@ -477,9 +477,9 @@
   {
     rel_date dt(year(2011),oct,day(22));
     dt = dt - years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(dt.year()==2010);
+ BOOST_TEST(dt.month()==oct);
+ BOOST_TEST(dt.day()==22);
   }
   // TODO add exceptional cases bad result year
 

Modified: sandbox/chrono_date/libs/date/test/dates/ydoy/ydoy_date_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/dates/ydoy/ydoy_date_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/dates/ydoy/ydoy_date_pass.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -19,133 +19,143 @@
   typedef boost::chrono::duration<double, boost::micro> micros;
 
   { // construct from ymd: 0/1/1
- ydoy_date dt(year(0),jan,day(1));
+ //ydoy_date dt(year(0),jan,day(1));
+ ydoy_date dt(jan/day(1)/year(0));
     BOOST_TEST( dt.is_valid());
     BOOST_TEST(dt.days_since_epoch().count()==11979588);
   }
   { // unchecked construct from bad ymd: 0/0/0 results in valid date
- ydoy_date dt(year(0),month(0),day(0));
+
+ ymd_date dt2(year(0),month(0),day(0));
+ ydoy_date dt(dt2);
     std::cout <<"0/0/0 days "<< dt.days_since_epoch().count() << std::endl;
     BOOST_TEST( ! dt.is_valid());
   }
   { // unchecked construct from bad ymd: 0/0/0 results in valid date
- ydoy_date dt(year(40000),month(1),day(1));
+ ymd_date dt2(year(40000),month(1),day(1));
+ ydoy_date dt(dt2);
     BOOST_TEST( ! year(40000).is_valid());
- //BOOST_TEST( ! dt.is_valid());
- }
- { // bad construction from bad days: 0
- try {
- ydoy_date dt(days(0), check);
- BOOST_TEST( false );
- } catch (...) {}
+ BOOST_TEST( dt.is_valid());
   }
+// { // bad construction from bad days: 0
+// try {
+// ydoy_date dt(days(0), check);
+// BOOST_TEST( false );
+// } catch (...) {}
+// }
   std::cout <<"******* "<< std::endl;
 
- { // construct from days: 0/1/1
- ydoy_date dt(days(11979588));
- std::cout <<dt<< std::endl;
- std::cout <<"******* "<< std::endl;
- std::cout <<dt.days_since_epoch().count()<< std::endl;
-
- BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.days_since_epoch().count()==11979588);
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
- }
+// { // construct from days: 0/1/1
+// ydoy_date dt(days(11979588));
+// std::cout <<dt<< std::endl;
+// std::cout <<"******* "<< std::endl;
+// std::cout <<dt.days_since_epoch().count()<< std::endl;
+//
+// BOOST_TEST( dt.is_valid());
+// BOOST_TEST(dt.days_since_epoch().count()==11979588);
+// BOOST_TEST(year(dt)==0);
+// BOOST_TEST(dt.to_month()==1);
+// BOOST_TEST(day(to_ymd_date(dt))==1);
+// }
   { // default constructor
     ydoy_date dt;
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==0);
+ BOOST_TEST(dt.to_month()==1);
+ BOOST_TEST(day(to_ymd_date(dt))==1);
   }
   { // construct from ymd: 2011/oct/22
- ydoy_date dt(year(2011),oct,day(22), check);
+ ymd_date dt2(year(2011),oct,day(22), check);
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(dt.to_month()==oct);
+ BOOST_TEST(day(to_ymd_date(dt))==22);
   }
   { // no_check construct from bad ymd: 2011/oct/22
- ydoy_date dt(year(2011),oct,day(22));
+ ymd_date dt2(year(2011),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(dt.to_month()==oct);
+ BOOST_TEST(day(to_ymd_date(dt))==22);
   }
   { // construct from ymd: 2011/jan_01
- ydoy_date dt(year(2011),jan_01, check);
+ ymd_date dt2(year(2011),jan_01, check);
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(day(to_ymd_date(dt))==1);
   }
   { // no_check construct from ymd: 2011/jan_01
- ydoy_date dt(year(2011),jan_01);
+ ymd_date dt2(year(2011),jan_01);
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(day(to_ymd_date(dt))==1);
   }
   { // construct from ymd: first day: -32768/jan_01
- ydoy_date dt(year(-32768),jan_01, check);
+ ymd_date dt2(year(-32768),jan_01, check);
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==-32768);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(day(to_ymd_date(dt))==1);
     BOOST_TEST(dt.days_since_epoch().count()==11322);
 
     std::cout <<"-32768/jan/01 days "<< dt.days_since_epoch().count() << std::endl;
   }
   { // construct from ymd: last day: 32767/dec/31
- ydoy_date dt(year(32767),dec,day(31), check);
+ ymd_date dt2(year(32767),dec,day(31), check);
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(year(dt)==32767);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(day(to_ymd_date(dt))==31);
     BOOST_TEST(dt.days_since_epoch().count()==23947853);
     std::cout <<"32767/12/31 days "<< dt.days_since_epoch().count() << std::endl;
   }
- { // construct from days: first day: -32768/jan_01
- ydoy_date dt(days(11322), check);
- BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
-
- }
- { // construct from days: last day: 32767/dec/31
- ydoy_date dt(days(23947853), check);
- BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
- }
+// { // construct from days: first day: -32768/jan_01
+// ydoy_date dt(days(11322), check);
+// BOOST_TEST( dt.is_valid());
+// BOOST_TEST(year(dt)==-32768);
+// BOOST_TEST(dt.to_month()==jan);
+// BOOST_TEST(day(to_ymd_date(dt))==1);
+//
+// }
+// { // construct from days: last day: 32767/dec/31
+// ydoy_date dt(days(23947853), check);
+// BOOST_TEST( dt.is_valid());
+// BOOST_TEST(year(dt)==32767);
+// BOOST_TEST(dt.to_month()==dec);
+// BOOST_TEST(day(to_ymd_date(dt))==31);
+// }
 
 
   { // construct from year + doy:
     ydoy_date dt(year(2011), day_of_year(1), check);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(dt.to_month()==jan);
+ BOOST_TEST(day(to_ymd_date(dt))==1);
   }
 
   { // construct from year + doy:
     ydoy_date dt(year(2011), day_of_year(365), check);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(day(to_ymd_date(dt))==31);
   }
   { // construct from year + doy:
     BOOST_TEST( year(2012).is_leap());
     ydoy_date dt(year(2012), day_of_year(366));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(year(dt)==2012);
+ BOOST_TEST(dt.to_month()==dec);
+ BOOST_TEST(day(to_ymd_date(dt))==31);
   }
 
   { // construct from bad (year + doy):
@@ -157,369 +167,385 @@
 
   // TODO Add construct from year + week + weekday
 
- { // construct from today
- ydoy_date dt = ydoy_date::today();
- BOOST_TEST( dt.is_valid());
- }
- { // conversions to/from system_clock::time_point
- ydoy_date dt(year(2011),oct,day(22));
- boost::chrono::system_clock::time_point tp=boost::chrono::system_clock::time_point(dt);
- ydoy_date dt2(tp);
- BOOST_TEST( dt == dt2);
- }
+// { // construct from today
+// ydoy_date dt = ydoy_date::today();
+// BOOST_TEST( dt.is_valid());
+// }
+// { // conversions to/from system_clock::time_point
+// ydoy_date dt(year(2011),oct,day(22));
+// boost::chrono::system_clock::time_point tp=boost::chrono::system_clock::time_point(dt);
+// ydoy_date dt2(tp);
+// BOOST_TEST( dt == dt2);
+// }
   // is_leap_year
   {
- ydoy_date dt(year(2011),oct,day(22));
+ ymd_date dt2(year(2011),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( ! dt.is_leap_year());
   }
   {
- ydoy_date dt(year(0),oct,day(22));
+ ymd_date dt2(year(0),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_leap_year());
   }
   {
- ydoy_date dt(year(4),oct,day(22));
+ ymd_date dt2(year(4),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_leap_year());
   }
   {
- ydoy_date dt(year(400),oct,day(22));
+ ymd_date dt2(year(400),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( dt.is_leap_year());
   }
   {
- ydoy_date dt(year(100),oct,day(22));
+ ymd_date dt2(year(100),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( ! dt.is_leap_year());
   }
   {
- ydoy_date dt(year(200),oct,day(22));
+ ymd_date dt2(year(200),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( ! dt.is_leap_year());
   }
   {
- ydoy_date dt(year(300),oct,day(22));
+ ymd_date dt2(year(300),oct,day(22));
+ ydoy_date dt(dt2);
     BOOST_TEST( ! dt.is_leap_year());
   }
- // get_weekday
- {
- BOOST_TEST( ydoy_date(year(2011),oct,day(23)).get_weekday()==sun);
- BOOST_TEST( ydoy_date(year(2011),oct,day(24)).get_weekday()==mon);
- BOOST_TEST( ydoy_date(year(2011),oct,day(25)).get_weekday()==tue);
- BOOST_TEST( ydoy_date(year(2011),oct,day(26)).get_weekday()==wed);
- BOOST_TEST( ydoy_date(year(2011),oct,day(27)).get_weekday()==thu);
- BOOST_TEST( ydoy_date(year(2011),oct,day(28)).get_weekday()==fri);
- BOOST_TEST( ydoy_date(year(2011),oct,day(29)).get_weekday()==sat);
- }
- // day based arithmetic
- { //+=
- ydoy_date dt(days(1000000));
- dt+=days(10);
- BOOST_TEST( dt.days_since_epoch()==days(1000010));
- }
- { // += feb/28 no leap
- ydoy_date dt(year(2011),feb,day(28));
- dt+=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += feb/28 leap
- ydoy_date dt(year(2012),feb,day(28));
- dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
- { // += feb/29 leap
- ydoy_date dt(year(2012),feb,day(29));
- dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += month change
- ydoy_date dt(year(2011),oct,day(22));
- dt+=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += month+year change
- ydoy_date dt(year(2011),dec,day(22));
- dt+=days(10);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
- }
- { // dt++
- ydoy_date dt(days(1000000));
- ydoy_date dt2= dt++;
- BOOST_TEST( dt.days_since_epoch()==days(1000001));
- BOOST_TEST( dt2.days_since_epoch()==days(1000000));
- }
- { // ++dt
- ydoy_date dt(days(1000000));
- ydoy_date dt2 = ++dt;
- BOOST_TEST( dt.days_since_epoch()==days(1000001));
- BOOST_TEST( dt2.days_since_epoch()==days(1000001));
- }
-
- { // -=
- ydoy_date dt(days(1000010));
- dt-=days(10);
- BOOST_TEST( dt.days_since_epoch()==days(1000000));
- }
- { // dt--
- ydoy_date dt(days(1000001));
- ydoy_date dt2= dt--;
- BOOST_TEST( dt.days_since_epoch()==days(1000000));
- BOOST_TEST( dt2.days_since_epoch()==days(1000001));
- }
- { // --dt
- ydoy_date dt(days(1000001));
- ydoy_date dt2 = --dt;
- BOOST_TEST( dt.days_since_epoch()==days(1000000));
- BOOST_TEST( dt2.days_since_epoch()==days(1000000));
- }
- { // -= month + year change
- ydoy_date dt(year(2011),jan,day(10));
- dt-=days(10);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
- }
-
- { // -= month change
- ydoy_date dt(year(2011),oct,day(10));
- dt-=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==30);
- }
- {
- ydoy_date dt(year(2011),mar,day(1));
- dt-=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==28);
- }
- {
- ydoy_date dt(year(2012),mar,day(1));
- dt-=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
-
- {
- ydoy_date dt(days(1000000));
- ydoy_date dt2=dt+days(10);
- BOOST_TEST( dt2.days_since_epoch()==days(1000010));
- }
- {
- ydoy_date dt(days(1000000));
- ydoy_date dt2=days(10)+dt;
- BOOST_TEST( dt2.days_since_epoch()==days(1000010));
- }
- {
- ydoy_date dt(days(1000010));
- ydoy_date dt2=dt-days(10);
- BOOST_TEST( dt2.days_since_epoch()==days(1000000));
- }
- {
- ydoy_date dt(days(1000010));
- ydoy_date dt2(days(1000000));
- BOOST_TEST( dt-dt2==days(10));
- }
- {
- ydoy_date dt(days(1000010));
- ydoy_date dt2(days(1000000));
- BOOST_TEST( dt2-dt==days(-10));
- }
- // month based arithmetic
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt+=months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt = dt + months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt = months(1) + dt;
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt+=months(3);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2011),jan,day(29));
- try {
- dt+=months(1);
- BOOST_TEST(false);
- } catch (...) {}
- }
- {
- ydoy_date dt(year(2012),jan,day(29));
- dt+=months(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()=feb);
- BOOST_TEST(dt.get_day()==29);
- }
-
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt-=months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2012),mar,day(22));
- dt-=months(3);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt= dt-months(1);
-
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
- }
-
- // year based arithmetic
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt+=years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2012),feb,day(29));
- dt+=years(4);
- BOOST_TEST(dt.get_year()==2016);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
- {
- ydoy_date dt(year(2012),feb,day(29));
- try {
- dt+=years(1);
- BOOST_TEST(false);
- } catch (...) {}
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt = dt + years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt = years(1) + dt;
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt-=years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- {
- ydoy_date dt(year(2012),feb,day(29));
- dt-=years(4);
- BOOST_TEST(dt.get_year()==2008);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
- {
- ydoy_date dt(year(2012),feb,day(29));
- try {
- dt-=years(1);
- BOOST_TEST(false);
- } catch (...) {}
- }
- {
- ydoy_date dt(year(2011),oct,day(22));
- dt = dt - years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
- }
- // TODO add exceptional cases bad result year
-
- // Relational operators
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),oct,day(22));
- BOOST_TEST( dt1 == dt2 );
- }
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),oct,day(22));
- BOOST_TEST( dt1 >= dt2 );
- }
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),oct,day(22));
- BOOST_TEST( dt2 <= dt2 );
- }
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),sep,day(22));
- BOOST_TEST( dt1 >= dt2 );
- }
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),sep,day(22));
- BOOST_TEST( dt1 > dt2 );
- }
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),sep,day(22));
- BOOST_TEST( dt2 <= dt1 );
- }
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),sep,day(22));
- BOOST_TEST( dt2 < dt1 );
- }
- {
- ydoy_date dt1(year(2011),oct,day(22));
- ydoy_date dt2(year(2011),sep,day(22));
- BOOST_TEST( dt1 != dt2 );
- }
-
- // optional
- {
- optional<ydoy_date> odt = make_optional<ydoy_date>(year(2011),oct,day(22));
- BOOST_TEST( odt );
- }
- {
- optional<ydoy_date> odt = make_optional<ydoy_date>(year(2011),nov,day(31));
- BOOST_TEST( ! odt );
- }
+// // weekday
+// {
+// BOOST_TEST( ydoy_date(year(2011),oct,day(23)).to_weekday()==sun);
+// BOOST_TEST( ydoy_date(year(2011),oct,day(24)).to_weekday()==mon);
+// BOOST_TEST( ydoy_date(year(2011),oct,day(25)).to_weekday()==tue);
+// BOOST_TEST( ydoy_date(year(2011),oct,day(26)).to_weekday()==wed);
+// BOOST_TEST( ydoy_date(year(2011),oct,day(27)).to_weekday()==thu);
+// BOOST_TEST( ydoy_date(year(2011),oct,day(28)).to_weekday()==fri);
+// BOOST_TEST( ydoy_date(year(2011),oct,day(29)).to_weekday()==sat);
+// }
+// // day based arithmetic
+// { //+=
+// ydoy_date dt(days(1000000));
+// dt+=days(10);
+// BOOST_TEST( dt.days_since_epoch()==days(1000010));
+// }
+// { // += feb/28 no leap
+// ydoy_date dt(year(2011),feb,day(28));
+// dt+=days(1);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==mar);
+// BOOST_TEST(day(to_ymd_date(dt))==1);
+// }
+// { // += feb/28 leap
+// ydoy_date dt(year(2012),feb,day(28));
+// dt+=days(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==feb);
+// BOOST_TEST(day(to_ymd_date(dt))==29);
+// }
+// { // += feb/29 leap
+// ydoy_date dt(year(2012),feb,day(29));
+// dt+=days(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==mar);
+// BOOST_TEST(day(to_ymd_date(dt))==1);
+// }
+// { // += month change
+// ydoy_date dt(year(2011),oct,day(22));
+// dt+=days(10);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==nov);
+// BOOST_TEST(day(to_ymd_date(dt))==1);
+// }
+// { // += month+year change
+// ydoy_date dt(year(2011),dec,day(22));
+// dt+=days(10);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==jan);
+// BOOST_TEST(day(to_ymd_date(dt))==1);
+// }
+// { // dt++
+// ydoy_date dt(days(1000000));
+// ydoy_date dt2= dt++;
+// BOOST_TEST( dt.days_since_epoch()==days(1000001));
+// BOOST_TEST( dt2.days_since_epoch()==days(1000000));
+// }
+// { // ++dt
+// ydoy_date dt(days(1000000));
+// ydoy_date dt2 = ++dt;
+// BOOST_TEST( dt.days_since_epoch()==days(1000001));
+// BOOST_TEST( dt2.days_since_epoch()==days(1000001));
+// }
+//
+// { // -=
+// ydoy_date dt(days(1000010));
+// dt-=days(10);
+// BOOST_TEST( dt.days_since_epoch()==days(1000000));
+// }
+// { // dt--
+// ydoy_date dt(days(1000001));
+// ydoy_date dt2= dt--;
+// BOOST_TEST( dt.days_since_epoch()==days(1000000));
+// BOOST_TEST( dt2.days_since_epoch()==days(1000001));
+// }
+// { // --dt
+// ydoy_date dt(days(1000001));
+// ydoy_date dt2 = --dt;
+// BOOST_TEST( dt.days_since_epoch()==days(1000000));
+// BOOST_TEST( dt2.days_since_epoch()==days(1000000));
+// }
+// { // -= month + year change
+// ydoy_date dt(year(2011),jan,day(10));
+// dt-=days(10);
+// BOOST_TEST(year(dt)==2010);
+// BOOST_TEST(dt.to_month()==dec);
+// BOOST_TEST(day(to_ymd_date(dt))==31);
+// }
+//
+// { // -= month change
+// ydoy_date dt(year(2011),oct,day(10));
+// dt-=days(10);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==sep);
+// BOOST_TEST(day(to_ymd_date(dt))==30);
+// }
+// {
+// ydoy_date dt(year(2011),mar,day(1));
+// dt-=days(1);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==feb);
+// BOOST_TEST(day(to_ymd_date(dt))==28);
+// }
+// {
+// ydoy_date dt(year(2012),mar,day(1));
+// dt-=days(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==feb);
+// BOOST_TEST(day(to_ymd_date(dt))==29);
+// }
+//
+// {
+// ydoy_date dt(days(1000000));
+// ydoy_date dt2=dt+days(10);
+// BOOST_TEST( dt2.days_since_epoch()==days(1000010));
+// }
+// {
+// ydoy_date dt(days(1000000));
+// ydoy_date dt2=days(10)+dt;
+// BOOST_TEST( dt2.days_since_epoch()==days(1000010));
+// }
+// {
+// ydoy_date dt(days(1000010));
+// ydoy_date dt2=dt-days(10);
+// BOOST_TEST( dt2.days_since_epoch()==days(1000000));
+// }
+// {
+// ydoy_date dt(days(1000010));
+// ydoy_date dt2(days(1000000));
+// BOOST_TEST( dt-dt2==days(10));
+// }
+// {
+// ydoy_date dt(days(1000010));
+// ydoy_date dt2(days(1000000));
+// BOOST_TEST( dt2-dt==days(-10));
+// }
+// // month based arithmetic
+// {
+// ydoy_date dt(year(2011),oct,day(22));
+// dt+=months(1);
+//
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==nov);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ydoy_date dt(year(2011),oct,day(22));
+// dt = dt + months(1);
+//
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==nov);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ydoy_date dt(year(2011),oct,day(22));
+// dt = months(1) + dt;
+//
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==nov);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ydoy_date dt(year(2011),oct,day(22));
+// dt+=months(3);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==jan);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ydoy_date dt(year(2011),jan,day(29));
+// try {
+// dt+=months(1);
+// BOOST_TEST(false);
+// } catch (...) {}
+// }
+// {
+// ydoy_date dt(year(2012),jan,day(29));
+// dt+=months(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()=feb);
+// BOOST_TEST(day(to_ymd_date(dt))==29);
+// }
+//
+// {
+// ydoy_date dt(year(2011),oct,day(22));
+// dt-=months(1);
+//
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==sep);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ydoy_date dt(year(2012),mar,day(22));
+// dt-=months(3);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==dec);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ydoy_date dt(year(2011),oct,day(22));
+// dt= dt-months(1);
+//
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(dt.to_month()==sep);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+
+// // year based arithmetic
+// {
+// ymd_date dt2(year(2011),oct,day(22));
+// ydoy_date dt(dt2);
+// dt+=years(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ymd_date dt2(year(2012),feb,day(29));
+// ydoy_date dt(dt2);
+// dt+=years(4);
+// BOOST_TEST(year(dt)==2016);
+// BOOST_TEST(dt.to_month()==feb);
+// BOOST_TEST(day(to_ymd_date(dt))==29);
+// }
+// {
+// ymd_date dt2(year(2012),feb,day(29));
+// ydoy_date dt(dt2);
+// try {
+// dt+=years(1);
+// BOOST_TEST(false);
+// } catch (...) {}
+// }
+// {
+// ymd_date dt2(year(2011),oct,day(22));
+// ydoy_date dt(dt2);
+// dt = dt + years(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ymd_date dt2(year(2011),oct,day(22));
+// ydoy_date dt(dt2);
+// dt = years(1) + dt;
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ymd_date dt2(year(2011),oct,day(22));
+// ydoy_date dt(dt2);
+// dt-=years(1);
+// BOOST_TEST(year(dt)==2010);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// {
+// ymd_date dt2(year(2012),feb,day(29));
+// ydoy_date dt(dt2);
+// dt-=years(4);
+// BOOST_TEST(year(dt)==2008);
+// BOOST_TEST(dt.to_month()==feb);
+// BOOST_TEST(day(to_ymd_date(dt))==29);
+// }
+// {
+// ymd_date dt2(year(2012),feb,day(29));
+// ydoy_date dt(dt2);
+// try {
+// dt-=years(1);
+// BOOST_TEST(false);
+// } catch (...) {}
+// }
+// {
+// ymd_date dt2(year(2011),oct,day(22));
+// ydoy_date dt(dt2);
+// dt = dt - years(1);
+// BOOST_TEST(year(dt)==2010);
+// BOOST_TEST(dt.to_month()==oct);
+// BOOST_TEST(day(to_ymd_date(dt))==22);
+// }
+// // TODO add exceptional cases bad result year
+
+// // Relational operators
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),oct,day(22));
+// BOOST_TEST( dt1 == dt2 );
+// }
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),oct,day(22));
+// BOOST_TEST( dt1 >= dt2 );
+// }
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),oct,day(22));
+// BOOST_TEST( dt2 <= dt2 );
+// }
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),sep,day(22));
+// BOOST_TEST( dt1 >= dt2 );
+// }
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),sep,day(22));
+// BOOST_TEST( dt1 > dt2 );
+// }
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),sep,day(22));
+// BOOST_TEST( dt2 <= dt1 );
+// }
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),sep,day(22));
+// BOOST_TEST( dt2 < dt1 );
+// }
+// {
+// ydoy_date dt1(year(2011),oct,day(22));
+// ydoy_date dt2(year(2011),sep,day(22));
+// BOOST_TEST( dt1 != dt2 );
+// }
+//
+// // optional
+// {
+// optional<ydoy_date> odt = make_optional<ydoy_date>(year(2011),oct,day(22));
+// BOOST_TEST( odt );
+// }
+// {
+// optional<ydoy_date> odt = make_optional<ydoy_date>(year(2011),nov,day(31));
+// BOOST_TEST( ! odt );
+// }
 
 
 #if 0
@@ -560,9 +586,9 @@
 
   {
     ydoy_date dt = aug / day(16) / 2011;
- int d = dt.get_day(); // d == 16
- int m = dt.get_month(); // m == 8
- int y = dt.get_year(); // y == 2011
+ int d = day(to_ymd_date(dt)); // d == 16
+ int m = dt.to_month(); // m == 8
+ int y = year(dt); // y == 2011
     std::cout << dt << '\n';
     std::cout << y << " " << m << " " << d << '\n';
     std::cout << '\n';
@@ -572,10 +598,10 @@
     ydoy_date dt = aug / day(16) / 2011;
     // ...
     // Create ydoy_date with the same month and year but on the 5th
- ydoy_date dt2 = dt.get_year() / dt.get_month() / 5; // aug/5/2011
- int d = dt.get_day(); // d == 5
- int m = dt.get_month(); // m == 8
- int y = dt.get_year(); // y == 2011
+ ydoy_date dt2 = year(dt) / dt.to_month() / 5; // aug/5/2011
+ int d = day(to_ymd_date(dt)); // d == 5
+ int m = dt.to_month(); // m == 8
+ int y = year(dt); // y == 2011
     std::cout << dt << '\n';
     std::cout << y << " " << m << " " << d << '\n';
     std::cout << '\n';
@@ -584,7 +610,7 @@
   {
     ydoy_date dt = aug / day(16) / 2011;
     // What day of the week is this?
- int wd = dt.get_weekday(); // 2 (Tuesday)
+ int wd = dt.to_weekday(); // 2 (Tuesday)
     std::cout << dt << '\n';
     std::cout << wd << '\n';
   }
@@ -635,8 +661,8 @@
   }
 
   {
- // int num_fri_in_may = (_fri[last]/may/2011).get_day() > 28 ? 5 : 4; // 4
- int num_fri_in_may = (last_week * fri / may / 2011).get_day() > 28 ? 5 : 4; // 4
+ // int num_fri_in_may = (_fri[last]/may/2011).to_day() > 28 ? 5 : 4; // 4
+ int num_fri_in_may = (last_week * fri / may / 2011).to_day() > 28 ? 5 : 4; // 4
     std::cout << "Number of fridays in May" << num_fri_in_may << '\n';
 
     // ydoy_date d1 = rel_weekday(5)[_1st]/may/2011;
@@ -693,8 +719,8 @@
     for (rel_date d = last / jan / 2011, e = last / dec / 2011; i < 20 && d
         <= e; d += months(1))
     {
- if (d.get_day() >= 29)
- std::cout << d.get_year() / d.get_month() / 29 << '\n';
+ if (d.to_day() >= 29)
+ std::cout << d.year() / d.to_month() / 29 << '\n';
       ++i;
     }
   }
@@ -717,9 +743,9 @@
     // ...
     // Get the ydoy_date that is the first occurrence of the same day of the week
     // in the same month of the next year
- //rel_date dt2 = dt.get_weekday()[_1st]/dt.get_month()/(dt.get_year() + 1); // aug/7/2012, first Tuesday of Aug 2012
- rel_date dt2 = _1st_week * dt.get_weekday() / dt.get_month()
- / (dt.get_year() + 1); // aug/7/2012, first Tuesday of Aug 2012
+ //rel_date dt2 = dt.to_weekday()[_1st]/dt.to_month()/(year(dt) + 1); // aug/7/2012, first Tuesday of Aug 2012
+ rel_date dt2 = _1st_week * dt.to_weekday() / dt.to_month()
+ / (year(dt) + 1); // aug/7/2012, first Tuesday of Aug 2012
     std::cout << dt << '\n';
     std::cout << dt2 << '\n';
   }

Modified: sandbox/chrono_date/libs/date/test/dates/ymd/ymd_date_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/dates/ymd/ymd_date_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/dates/ymd/ymd_date_pass.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -22,143 +22,143 @@
   { // construct from ymd: 0/1/1
     ymd_date dt(year(0),jan,day(1));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.days_since_epoch().count()==11979588);
+ BOOST_TEST(days_date(dt).days_since_epoch().count()==11979588);
   }
   std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
   { // unchecked construct from bad ymd: 0/0/0 results in valid date
     ymd_date dt(year(0),month(0),day(0));
- std::cout <<"0/0/0 days "<< dt.days_since_epoch().count() << std::endl;
+ std::cout <<"0/0/0 days "<< days_date(dt).days_since_epoch().count() << std::endl;
     BOOST_TEST( ! dt.is_valid());
   }
   std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
   { // unchecked construct from bad ymd: 0/0/0 results in valid date
     ymd_date dt(year(40000),month(1),day(1));
     BOOST_TEST( ! year(40000).is_valid());
- //BOOST_TEST( ! dt.is_valid());
- }
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
- { // bad construction from bad days: 0
- try {
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
- days dd(0);
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
- ymd_date dt(days(0), check);
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
- BOOST_TEST( false );
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
- } catch (...) {}
+ BOOST_TEST( dt.is_valid());
   }
+// std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+// { // bad construction from bad days: 0
+// try {
+// std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+// days dd(0);
+// std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+// ymd_date dt(days(0), check);
+// std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+// BOOST_TEST( false );
+// std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+// } catch (...) {}
+// }
   std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
   { // construct from days: 0/1/1
     ymd_date dt(days(11979588));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.days_since_epoch().count()==11979588);
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(days_date(dt).days_since_epoch().count()==11979588);
+ BOOST_TEST(year(dt)==0);
+ BOOST_TEST(month(dt)==1);
+ BOOST_TEST(day(dt)==1);
   }
   std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
   { // default constructor
     ymd_date dt;
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==0);
- BOOST_TEST(dt.get_month()==1);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==0);
+ BOOST_TEST(month(dt)==1);
+ BOOST_TEST(day(dt)==1);
   }
   { // construct from ymd: 2011/oct/22
     ymd_date dt(year(2011),oct,day(22), check);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==oct);
+ BOOST_TEST(day(dt)==22);
   }
   { // no_check construct from bad ymd: 2011/oct/22
     ymd_date dt(year(2011),oct,day(22));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==oct);
+ BOOST_TEST(day(dt)==22);
   }
   { // construct from ymd: 2011/jan_01
     ymd_date dt(year(2011),jan_01);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==jan);
+ BOOST_TEST(day(dt)==1);
   }
   { // no_check construct from ymd: 2011/jan_01
     ymd_date dt(year(2011),jan_01);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==jan);
+ BOOST_TEST(day(dt)==1);
   }
   { // construct from ymd: first day: -32768/jan_01
     ymd_date dt(year(-32768),jan_01);
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
- BOOST_TEST(dt.days_since_epoch().count()==11322);
+ BOOST_TEST(year(dt)==-32768);
+ BOOST_TEST(month(dt)==jan);
+ BOOST_TEST(day(dt)==1);
+ BOOST_TEST(days_date(dt).days_since_epoch().count()==11322);
 
- std::cout <<"-32768/jan/01 days "<< dt.days_since_epoch().count() << std::endl;
+ std::cout <<"-32768/jan/01 days "<< days_date(dt).days_since_epoch().count() << std::endl;
   }
   { // construct from ymd: last day: 32767/dec/31
     ymd_date dt(year(32767),dec,day(31));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
- BOOST_TEST(dt.days_since_epoch().count()==23947853);
- std::cout <<"32767/12/31 days "<< dt.days_since_epoch().count() << std::endl;
+ BOOST_TEST(year(dt)==32767);
+ BOOST_TEST(month(dt)==dec);
+ BOOST_TEST(day(dt)==31);
+ BOOST_TEST(days_date(dt).days_since_epoch().count()==23947853);
+ std::cout <<"32767/12/31 days "<< days_date(dt).days_since_epoch().count() << std::endl;
   }
   { // construct from days: first day: -32768/jan_01
     ymd_date dt(days(11322));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==-32768);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
+ BOOST_TEST(year(dt)==-32768);
+ BOOST_TEST(month(dt)==jan);
+ BOOST_TEST(day(dt)==1);
 
   }
   { // construct from days: last day: 32767/dec/31
     ymd_date dt(days(23947853));
     BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==32767);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
+ BOOST_TEST(year(dt)==32767);
+ BOOST_TEST(month(dt)==dec);
+ BOOST_TEST(day(dt)==31);
   }
 
 
- { // construct from year + doy:
- ymd_date dt(year(2011), day_of_year(1));
- BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
- }
-
- { // construct from year + doy:
- ymd_date dt(year(2011), day_of_year(365));
- BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
- }
- { // construct from year + doy:
- BOOST_TEST( year(2012).is_leap());
- ymd_date dt(year(2012), day_of_year(366));
- BOOST_TEST( dt.is_valid());
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
- }
-
- { // construct from bad (year + doy):
- try {
- ymd_date dt(year(2011), day_of_year(366), check);
- BOOST_TEST( false );
- } catch (...) {}
- }
+// { // construct from year + doy:
+// ymd_date dt(year(2011), day_of_year(1));
+// BOOST_TEST( dt.is_valid());
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(month(dt)==jan);
+// BOOST_TEST(day(dt)==1);
+// }
+//
+// { // construct from year + doy:
+// ymd_date dt(year(2011), day_of_year(365));
+// BOOST_TEST( dt.is_valid());
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(month(dt)==dec);
+// BOOST_TEST(day(dt)==31);
+// }
+// { // construct from year + doy:
+// BOOST_TEST( year(2012).is_leap());
+// ymd_date dt(year(2012), day_of_year(366));
+// BOOST_TEST( dt.is_valid());
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(month(dt)==dec);
+// BOOST_TEST(day(dt)==31);
+// }
+//
+// { // construct from bad (year + doy):
+// try {
+// ymd_date dt(year(2011), day_of_year(366), check);
+// BOOST_TEST( false );
+// } catch (...) {}
+// }
 
   // TODO Add construct from year + week + weekday
 
@@ -201,173 +201,173 @@
     ymd_date dt(year(300),oct,day(22));
     BOOST_TEST( ! dt.is_leap_year());
   }
- // get_weekday
- {
- BOOST_TEST( ymd_date(year(2011),oct,day(23)).get_weekday()==sun);
- BOOST_TEST( ymd_date(year(2011),oct,day(24)).get_weekday()==mon);
- BOOST_TEST( ymd_date(year(2011),oct,day(25)).get_weekday()==tue);
- BOOST_TEST( ymd_date(year(2011),oct,day(26)).get_weekday()==wed);
- BOOST_TEST( ymd_date(year(2011),oct,day(27)).get_weekday()==thu);
- BOOST_TEST( ymd_date(year(2011),oct,day(28)).get_weekday()==fri);
- BOOST_TEST( ymd_date(year(2011),oct,day(29)).get_weekday()==sat);
- }
- // day based arithmetic
- { //+=
- ymd_date dt(days(1000000));
- dt+=days(10);
- BOOST_TEST( dt.days_since_epoch()==days(1000010));
- }
- { // += feb/28 no leap
- ymd_date dt(year(2011),feb,day(28));
- dt+=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += feb/28 leap
- ymd_date dt(year(2012),feb,day(28));
- dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
- { // += feb/29 leap
- ymd_date dt(year(2012),feb,day(29));
- dt+=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==mar);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += month change
- ymd_date dt(year(2011),oct,day(22));
- dt+=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==1);
- }
- { // += month+year change
- ymd_date dt(year(2011),dec,day(22));
- dt+=days(10);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==1);
- }
- { // dt++
- ymd_date dt(days(1000000));
- ymd_date dt2= dt++;
- BOOST_TEST( dt.days_since_epoch()==days(1000001));
- BOOST_TEST( dt2.days_since_epoch()==days(1000000));
- }
- { // ++dt
- ymd_date dt(days(1000000));
- ymd_date dt2 = ++dt;
- BOOST_TEST( dt.days_since_epoch()==days(1000001));
- BOOST_TEST( dt2.days_since_epoch()==days(1000001));
- }
-
- { // -=
- ymd_date dt(days(1000010));
- dt-=days(10);
- BOOST_TEST( dt.days_since_epoch()==days(1000000));
- }
- { // dt--
- ymd_date dt(days(1000001));
- ymd_date dt2= dt--;
- BOOST_TEST( dt.days_since_epoch()==days(1000000));
- BOOST_TEST( dt2.days_since_epoch()==days(1000001));
- }
- { // --dt
- ymd_date dt(days(1000001));
- ymd_date dt2 = --dt;
- BOOST_TEST( dt.days_since_epoch()==days(1000000));
- BOOST_TEST( dt2.days_since_epoch()==days(1000000));
- }
- { // -= month + year change
- ymd_date dt(year(2011),jan,day(10));
- dt-=days(10);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==31);
- }
-
- { // -= month change
- ymd_date dt(year(2011),oct,day(10));
- dt-=days(10);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==30);
- }
- {
- ymd_date dt(year(2011),mar,day(1));
- dt-=days(1);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==28);
- }
- {
- ymd_date dt(year(2012),mar,day(1));
- dt-=days(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
- }
-
- {
- ymd_date dt(days(1000000));
- ymd_date dt2=dt+days(10);
- BOOST_TEST( dt2.days_since_epoch()==days(1000010));
- }
- {
- ymd_date dt(days(1000000));
- ymd_date dt2=days(10)+dt;
- BOOST_TEST( dt2.days_since_epoch()==days(1000010));
- }
- {
- ymd_date dt(days(1000010));
- ymd_date dt2=dt-days(10);
- BOOST_TEST( dt2.days_since_epoch()==days(1000000));
- }
- {
- ymd_date dt(days(1000010));
- ymd_date dt2(days(1000000));
- BOOST_TEST( dt-dt2==days(10));
- }
- {
- ymd_date dt(days(1000010));
- ymd_date dt2(days(1000000));
- BOOST_TEST( dt2-dt==days(-10));
- }
+// // weekday
+// {
+// BOOST_TEST( ymd_date(year(2011),oct,day(23)).weekday()==sun);
+// BOOST_TEST( ymd_date(year(2011),oct,day(24)).weekday()==mon);
+// BOOST_TEST( ymd_date(year(2011),oct,day(25)).weekday()==tue);
+// BOOST_TEST( ymd_date(year(2011),oct,day(26)).weekday()==wed);
+// BOOST_TEST( ymd_date(year(2011),oct,day(27)).weekday()==thu);
+// BOOST_TEST( ymd_date(year(2011),oct,day(28)).weekday()==fri);
+// BOOST_TEST( ymd_date(year(2011),oct,day(29)).weekday()==sat);
+// }
+// // day based arithmetic
+// { //+=
+// ymd_date dt(days(1000000));
+// dt+=days(10);
+// BOOST_TEST( days_date(dt).days_since_epoch()==days(1000010));
+// }
+// { // += feb/28 no leap
+// ymd_date dt(year(2011),feb,day(28));
+// dt+=days(1);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(month(dt)==mar);
+// BOOST_TEST(day(dt)==1);
+// }
+// { // += feb/28 leap
+// ymd_date dt(year(2012),feb,day(28));
+// dt+=days(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(month(dt)==feb);
+// BOOST_TEST(day(dt)==29);
+// }
+// { // += feb/29 leap
+// ymd_date dt(year(2012),feb,day(29));
+// dt+=days(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(month(dt)==mar);
+// BOOST_TEST(day(dt)==1);
+// }
+// { // += month change
+// ymd_date dt(year(2011),oct,day(22));
+// dt+=days(10);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(month(dt)==nov);
+// BOOST_TEST(day(dt)==1);
+// }
+// { // += month+year change
+// ymd_date dt(year(2011),dec,day(22));
+// dt+=days(10);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(month(dt)==jan);
+// BOOST_TEST(day(dt)==1);
+// }
+// { // dt++
+// ymd_date dt(days(1000000));
+// ymd_date dt2= dt++;
+// BOOST_TEST( days_date(dt).days_since_epoch()==days(1000001));
+// BOOST_TEST( dt2.to_days()==days(1000000));
+// }
+// { // ++dt
+// ymd_date dt(days(1000000));
+// ymd_date dt2 = ++dt;
+// BOOST_TEST( days_date(dt).days_since_epoch()==days(1000001));
+// BOOST_TEST( dt2.to_days()==days(1000001));
+// }
+//
+// { // -=
+// ymd_date dt(days(1000010));
+// dt-=days(10);
+// BOOST_TEST( days_date(dt).days_since_epoch()==days(1000000));
+// }
+// { // dt--
+// ymd_date dt(days(1000001));
+// ymd_date dt2= dt--;
+// BOOST_TEST( days_date(dt).days_since_epoch()==days(1000000));
+// BOOST_TEST( dt2.to_days()==days(1000001));
+// }
+// { // --dt
+// ymd_date dt(days(1000001));
+// ymd_date dt2 = --dt;
+// BOOST_TEST( days_date(dt).days_since_epoch()==days(1000000));
+// BOOST_TEST( dt2.to_days()==days(1000000));
+// }
+// { // -= month + year change
+// ymd_date dt(year(2011),jan,day(10));
+// dt-=days(10);
+// BOOST_TEST(year(dt)==2010);
+// BOOST_TEST(month(dt)==dec);
+// BOOST_TEST(day(dt)==31);
+// }
+//
+// { // -= month change
+// ymd_date dt(year(2011),oct,day(10));
+// dt-=days(10);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(month(dt)==sep);
+// BOOST_TEST(day(dt)==30);
+// }
+// {
+// ymd_date dt(year(2011),mar,day(1));
+// dt-=days(1);
+// BOOST_TEST(year(dt)==2011);
+// BOOST_TEST(month(dt)==feb);
+// BOOST_TEST(day(dt)==28);
+// }
+// {
+// ymd_date dt(year(2012),mar,day(1));
+// dt-=days(1);
+// BOOST_TEST(year(dt)==2012);
+// BOOST_TEST(month(dt)==feb);
+// BOOST_TEST(day(dt)==29);
+// }
+//
+// {
+// ymd_date dt(days(1000000));
+// ymd_date dt2=dt+days(10);
+// BOOST_TEST( dt2.to_days()==days(1000010));
+// }
+// {
+// ymd_date dt(days(1000000));
+// ymd_date dt2=days(10)+dt;
+// BOOST_TEST( dt2.to_days()==days(1000010));
+// }
+// {
+// ymd_date dt(days(1000010));
+// ymd_date dt2=dt-days(10);
+// BOOST_TEST( dt2.to_days()==days(1000000));
+// }
+// {
+// ymd_date dt(days(1000010));
+// ymd_date dt2(days(1000000));
+// BOOST_TEST( dt-dt2==days(10));
+// }
+// {
+// ymd_date dt(days(1000010));
+// ymd_date dt2(days(1000000));
+// BOOST_TEST( dt2-dt==days(-10));
+// }
   // month based arithmetic
   {
     ymd_date dt(year(2011),oct,day(22));
     dt+=months(1);
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==nov);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2011),oct,day(22));
     dt = dt + months(1);
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==nov);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2011),oct,day(22));
     dt = months(1) + dt;
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==nov);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==nov);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2011),oct,day(22));
     dt+=months(3);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==jan);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2012);
+ BOOST_TEST(month(dt)==jan);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2011),jan,day(29));
@@ -379,49 +379,49 @@
   {
     ymd_date dt(year(2012),jan,day(29));
     dt+=months(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()=feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(year(dt)==2012);
+ BOOST_TEST(month(dt)=feb);
+ BOOST_TEST(day(dt)==29);
   }
 
   {
     ymd_date dt(year(2011),oct,day(22));
     dt-=months(1);
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==sep);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2012),mar,day(22));
     dt-=months(3);
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==dec);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==dec);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2011),oct,day(22));
     dt= dt-months(1);
 
- BOOST_TEST(dt.get_year()==2011);
- BOOST_TEST(dt.get_month()==sep);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2011);
+ BOOST_TEST(month(dt)==sep);
+ BOOST_TEST(day(dt)==22);
   }
 
   // year based arithmetic
   {
     ymd_date dt(year(2011),oct,day(22));
     dt+=years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2012);
+ BOOST_TEST(month(dt)==oct);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2012),feb,day(29));
     dt+=years(4);
- BOOST_TEST(dt.get_year()==2016);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(year(dt)==2016);
+ BOOST_TEST(month(dt)==feb);
+ BOOST_TEST(day(dt)==29);
   }
   {
     ymd_date dt(year(2012),feb,day(29));
@@ -433,30 +433,30 @@
   {
     ymd_date dt(year(2011),oct,day(22));
     dt = dt + years(1);
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2012);
+ BOOST_TEST(month(dt)==oct);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2011),oct,day(22));
     dt = years(1) + dt;
- BOOST_TEST(dt.get_year()==2012);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2012);
+ BOOST_TEST(month(dt)==oct);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2011),oct,day(22));
     dt-=years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2010);
+ BOOST_TEST(month(dt)==oct);
+ BOOST_TEST(day(dt)==22);
   }
   {
     ymd_date dt(year(2012),feb,day(29));
     dt-=years(4);
- BOOST_TEST(dt.get_year()==2008);
- BOOST_TEST(dt.get_month()==feb);
- BOOST_TEST(dt.get_day()==29);
+ BOOST_TEST(year(dt)==2008);
+ BOOST_TEST(month(dt)==feb);
+ BOOST_TEST(day(dt)==29);
   }
   {
     ymd_date dt(year(2012),feb,day(29));
@@ -468,9 +468,9 @@
   {
     ymd_date dt(year(2011),oct,day(22));
     dt = dt - years(1);
- BOOST_TEST(dt.get_year()==2010);
- BOOST_TEST(dt.get_month()==oct);
- BOOST_TEST(dt.get_day()==22);
+ BOOST_TEST(year(dt)==2010);
+ BOOST_TEST(month(dt)==oct);
+ BOOST_TEST(day(dt)==22);
   }
   // TODO add exceptional cases bad result year
 
@@ -525,13 +525,13 @@
     optional<ymd_date> odt = make_optional<ymd_date>(year(2011),nov,day(31));
     BOOST_TEST( ! odt );
   }
- {
- ymd_date d1(year(2013), may, day(66));
- ymd_date d2 = d1 + days(1);
- std::cout << d2.get_year() << std::endl;
- std::cout << d2.get_month() << std::endl;
- std::cout << d2.get_day() << std::endl;
- }
+// {
+// ymd_date d1(year(2013), may, day(66));
+// ymd_date d2 = d1 + days(1);
+// std::cout << year(d2) << std::endl;
+// std::cout << month(d2) << std::endl;
+// std::cout << day(d2) << std::endl;
+// }
 
 
 #if 0
@@ -572,9 +572,9 @@
 
   {
     ymd_date dt = aug / day(16) / 2011;
- int d = dt.get_day(); // d == 16
- int m = dt.get_month(); // m == 8
- int y = dt.get_year(); // y == 2011
+ int d = day(dt); // d == 16
+ int m = month(dt); // m == 8
+ int y = year(dt); // y == 2011
     std::cout << dt << '\n';
     std::cout << y << " " << m << " " << d << '\n';
     std::cout << '\n';
@@ -584,10 +584,10 @@
     ymd_date dt = aug / day(16) / 2011;
     // ...
     // Create ymd_date with the same month and year but on the 5th
- ymd_date dt2 = dt.get_year() / dt.get_month() / 5; // aug/5/2011
- int d = dt.get_day(); // d == 5
- int m = dt.get_month(); // m == 8
- int y = dt.get_year(); // y == 2011
+ ymd_date dt2 = year(dt) / month(dt) / 5; // aug/5/2011
+ int d = day(dt); // d == 5
+ int m = month(dt); // m == 8
+ int y = year(dt); // y == 2011
     std::cout << dt << '\n';
     std::cout << y << " " << m << " " << d << '\n';
     std::cout << '\n';
@@ -596,7 +596,7 @@
   {
     ymd_date dt = aug / day(16) / 2011;
     // What day of the week is this?
- int wd = dt.get_weekday(); // 2 (Tuesday)
+ int wd = dt.weekday(); // 2 (Tuesday)
     std::cout << dt << '\n';
     std::cout << wd << '\n';
   }
@@ -647,8 +647,8 @@
   }
 
   {
- // int num_fri_in_may = (_fri[last]/may/2011).get_day() > 28 ? 5 : 4; // 4
- int num_fri_in_may = (last_week * fri / may / 2011).get_day() > 28 ? 5 : 4; // 4
+ // int num_fri_in_may = (_fri[last]/may/2011).day() > 28 ? 5 : 4; // 4
+ int num_fri_in_may = day(last_week * fri / may / 2011) > 28 ? 5 : 4; // 4
     std::cout << "Number of fridays in May" << num_fri_in_may << '\n';
 
     // ymd_date d1 = rel_weekday(5)[_1st]/may/2011;
@@ -705,8 +705,8 @@
     for (rel_date d = last / jan / 2011, e = last / dec / 2011; i < 20 && d
         <= e; d += months(1))
     {
- if (d.get_day() >= 29)
- std::cout << d.get_year() / d.get_month() / 29 << '\n';
+ if (day(d) >= 29)
+ std::cout << year(d) / month(d) / 29 << '\n';
       ++i;
     }
   }
@@ -729,9 +729,9 @@
     // ...
     // Get the ymd_date that is the first occurrence of the same day of the week
     // in the same month of the next year
- //rel_date dt2 = dt.get_weekday()[_1st]/dt.get_month()/(dt.get_year() + 1); // aug/7/2012, first Tuesday of Aug 2012
- rel_date dt2 = _1st_week * dt.get_weekday() / dt.get_month()
- / (dt.get_year() + 1); // aug/7/2012, first Tuesday of Aug 2012
+ //rel_date dt2 = dt.weekday()[_1st]/month(dt)/(year(dt) + 1); // aug/7/2012, first Tuesday of Aug 2012
+ rel_date dt2 = _1st_week * dt.weekday() / month(dt)
+ / (year(dt) + 1); // aug/7/2012, first Tuesday of Aug 2012
     std::cout << dt << '\n';
     std::cout << dt2 << '\n';
   }

Modified: sandbox/chrono_date/libs/date/test/wrappers/day_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/wrappers/day_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/wrappers/day_pass.cpp 2013-05-11 11:54:21 EDT (Sat, 11 May 2013)
@@ -3,7 +3,6 @@
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <boost/chrono/date/day.hpp>
-
 #include <boost/detail/lightweight_test.hpp>
 
 int main()


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