|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84244 - in sandbox/chrono_date: boost/chrono/date boost/chrono/date/detail libs/date/perf libs/date/src libs/date/test libs/date/test/dates/days libs/date/test/wrappers
From: vicente.botet_at_[hidden]
Date: 2013-05-12 09:15:29
Author: viboes
Date: 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
New Revision: 84244
URL: http://svn.boost.org/trac/boost/changeset/84244
Log:
Chrono/Date: refactor toward constexpr + force inline.
Added:
sandbox/chrono_date/libs/date/test/wrappers/day_of_year_fail.cpp (contents, props changed)
Text files modified:
sandbox/chrono_date/boost/chrono/date/config.hpp | 3
sandbox/chrono_date/boost/chrono/date/date_durations.hpp | 54 +++++-----
sandbox/chrono_date/boost/chrono/date/date_generators.hpp | 93 +++++++++---------
sandbox/chrono_date/boost/chrono/date/days_date.hpp | 58 +++++-----
sandbox/chrono_date/boost/chrono/date/detail/bounded.hpp | 54 +++++----
sandbox/chrono_date/boost/chrono/date/month.hpp | 6
sandbox/chrono_date/boost/chrono/date/no_check.hpp | 8
sandbox/chrono_date/boost/chrono/date/nth.hpp | 10
sandbox/chrono_date/boost/chrono/date/nth_week.hpp | 10
sandbox/chrono_date/boost/chrono/date/weekday.hpp | 6
sandbox/chrono_date/boost/chrono/date/ydoy_date.hpp | 58 +++++-----
sandbox/chrono_date/boost/chrono/date/year.hpp | 29 +----
sandbox/chrono_date/boost/chrono/date/ymd_date.hpp | 201 ++++++++++++++++++++++++++-------------
sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp | 78 ++++++++++----
sandbox/chrono_date/libs/date/src/conversions.cpp | 15 -
sandbox/chrono_date/libs/date/src/vars.cpp | 9 +
sandbox/chrono_date/libs/date/src/ymd_date.cpp | 16 ---
sandbox/chrono_date/libs/date/test/Jamfile.v2 | 15 ++
sandbox/chrono_date/libs/date/test/dates/days/days_date_pass.cpp | 14 ++
sandbox/chrono_date/libs/date/test/wrappers/day_of_year_pass.cpp | 2
sandbox/chrono_date/libs/date/test/wrappers/day_pass.cpp | 2
sandbox/chrono_date/libs/date/test/wrappers/nth_week_pass.cpp | 16 --
sandbox/chrono_date/libs/date/test/wrappers/week_pass.cpp | 2
sandbox/chrono_date/libs/date/test/wrappers/weekday_pass.cpp | 2
24 files changed, 432 insertions(+), 329 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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -8,6 +8,8 @@
#ifndef BOOST_CHRONO_DATE_CONFIG_HPP
#define BOOST_CHRONO_DATE_CONFIG_HPP
+//#define BOOST_FORCEINLINE inline __attribute__ ((always_inline))
+
#include <boost/chrono/config.hpp>
// 1 => days + ymd + leap
@@ -37,6 +39,7 @@
#if ! defined BOOST_NO_CXX11_CONSTEXPR && defined __clang__
#define BOOST_CHRONO_DATE_CONSTEXPR BOOST_CONSTEXPR
#else
+#define BOOST_CHRONO_DATE_NO_CXX11_CONSTEXPR
#define BOOST_CHRONO_DATE_CONSTEXPR
#endif
Modified: sandbox/chrono_date/boost/chrono/date/date_durations.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/date_durations.hpp (original)
+++ sandbox/chrono_date/boost/chrono/date/date_durations.hpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -173,30 +173,30 @@
private:
rep x_;
public:
- explicit duration_type(rep x = rep()) BOOST_NOEXCEPT : x_(x)
+ explicit BOOST_FORCEINLINE BOOST_CONSTEXPR duration_type(rep x = rep()) BOOST_NOEXCEPT : x_(x)
{
}
- rep count() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR rep count() const BOOST_NOEXCEPT
{
return x_;
}
- duration_type operator+() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR duration_type operator+() const BOOST_NOEXCEPT
{
return *this;
}
- duration_type operator-() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR duration_type operator-() const BOOST_NOEXCEPT
{
return duration_type(-x_);
}
- duration_type& operator++() BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type& operator++() BOOST_NOEXCEPT
{
++x_;
return *this;
}
- duration_type operator++(int) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type operator++(int) BOOST_NOEXCEPT
{
return duration_type(x_++);
}
@@ -205,105 +205,105 @@
--x_;
return *this;
}
- duration_type operator--(int) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type operator--(int) BOOST_NOEXCEPT
{
return duration_type(x_--);
}
- duration_type& operator+=(const duration_type& rhs) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type& operator+=(const duration_type& rhs) BOOST_NOEXCEPT
{
x_ += rhs.x_;
return *this;
}
- duration_type& operator-=(const duration_type& rhs) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type& operator-=(const duration_type& rhs) BOOST_NOEXCEPT
{
x_ -= rhs.x_;
return *this;
}
- friend duration_type operator+(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE duration_type operator+(duration_type x, duration_type y) BOOST_NOEXCEPT
{
x += y;
return x;
}
- friend duration_type operator-(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE duration_type operator-(duration_type x, duration_type y) BOOST_NOEXCEPT
{
x -= y;
return x;
}
- duration_type& operator*=(const rep& rhs) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type& operator*=(const rep& rhs) BOOST_NOEXCEPT
{
x_ *= rhs;
return *this;
}
- duration_type& operator/=(const rep& rhs) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type& operator/=(const rep& rhs) BOOST_NOEXCEPT
{
x_ /= rhs;
return *this;
}
- duration_type& operator%=(const rep& rhs) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type& operator%=(const rep& rhs) BOOST_NOEXCEPT
{
x_ %= rhs;
return *this;
}
- duration_type& operator%=(const duration_type& rhs) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE duration_type& operator%=(const duration_type& rhs) BOOST_NOEXCEPT
{
x_ %= rhs.x_;
return *this;
}
- friend duration_type operator*(duration_type x, rep y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE duration_type operator*(duration_type x, rep y) BOOST_NOEXCEPT
{
x *= y;
return x;
}
- friend duration_type operator*(rep x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE duration_type operator*(rep x, duration_type y) BOOST_NOEXCEPT
{
y *= x;
return y;
}
- friend duration_type operator/(duration_type x, rep y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE duration_type operator/(duration_type x, rep y) BOOST_NOEXCEPT
{
x /= y;
return x;
}
- friend rep operator/(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE rep operator/(duration_type x, duration_type y) BOOST_NOEXCEPT
{
return x.x_ / y.x_;
}
- friend duration_type operator%(duration_type x, rep y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE duration_type operator%(duration_type x, rep y) BOOST_NOEXCEPT
{
x %= y;
return x;
}
- friend duration_type operator%(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE duration_type operator%(duration_type x, duration_type y) BOOST_NOEXCEPT
{
x %= y.x_;
return x;
}
- friend bool operator==(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator==(duration_type x, duration_type y) BOOST_NOEXCEPT
{
return x.x_ == y.x_;
}
- friend bool operator!=(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator!=(duration_type x, duration_type y) BOOST_NOEXCEPT
{
return !(x == y);
}
- friend bool operator< (duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator< (duration_type x, duration_type y) BOOST_NOEXCEPT
{
return x.x_ < y.x_;
}
- friend bool operator> (duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator> (duration_type x, duration_type y) BOOST_NOEXCEPT
{
return y < x;
}
- friend bool operator<=(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator<=(duration_type x, duration_type y) BOOST_NOEXCEPT
{
return !(y < x);
}
- friend bool operator>=(duration_type x, duration_type y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator>=(duration_type x, duration_type y) BOOST_NOEXCEPT
{
return !(x < y);
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -26,7 +26,37 @@
{
namespace chrono
{
-
+ namespace detail
+ {
+ BOOST_FORCEINLINE days_date
+ generate_lt(weekday::rep a, weekday::rep b, days_date x)
+ {
+ return (a < b)
+ ? (x - days(b-a))
+ : (x - days(weekday::size - (a-b)));
+ }
+ BOOST_FORCEINLINE days_date
+ generate_le(weekday::rep a, weekday::rep b, days_date x)
+ {
+ return (a <= b)
+ ? (x - days(b-a))
+ : (x - days(weekday::size - (a-b)));
+ }
+ BOOST_FORCEINLINE days_date
+ generate_gt(weekday::rep a, weekday::rep b, days_date x)
+ {
+ return (a < b)
+ ? (x + days(b-a))
+ : (x + days(weekday::size - (a-b)));
+ }
+ BOOST_FORCEINLINE days_date
+ generate_ge(weekday::rep a, weekday::rep b, days_date x)
+ {
+ return (a <= b)
+ ? (x + days(b-a))
+ : (x + days(weekday::size - (a-b)));
+ }
+ }
/**
* Generates a date satisfying the constraint parameter gt the Date parameter.
* @tparam Date any model of a Date (is_date<Date> is true_type).
@@ -36,60 +66,35 @@
* 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 days_date
+ BOOST_FORCEINLINE days_date
operator<(weekday wd, days_date x)
{
- const weekday::rep a = wd;
- const weekday::rep b = weekday(x);
- if (a < b)
- {
- return x - days(b-a);
- }
- return x - days(weekday::size - (a-b));
+ return detail::generate_lt(wd, weekday(x), x);
}
//template <typename Date>
- inline days_date
+ BOOST_FORCEINLINE days_date
operator<=(weekday wd, days_date x)
{
- const weekday::rep a = wd;
- const weekday::rep b = weekday(x);
- if (a <= b)
- {
- return x - days(b-a);
- }
- return x - days(weekday::size - (a-b));
+ return detail::generate_le(wd, weekday(x), x);
}
//template <typename Date>
- inline days_date
+ BOOST_FORCEINLINE days_date
operator>(weekday wd, days_date x)
{
- const weekday::rep b = wd;
- const weekday::rep a = weekday(x);
-
- if (a < b)
- {
- return x + days(b-a);
- }
- return x + days(weekday::size - (a-b));
+ return detail::generate_gt(wd, weekday(x), x);
}
//template <typename Date>
- inline days_date
+ BOOST_FORCEINLINE days_date
operator>=(weekday wd, days_date x)
{
- const weekday::rep b = wd;
- const weekday::rep a = weekday(x);
- if (a <= b)
- {
- return x + days(b-a);
- }
- return x + days(weekday::size - (a-b));
+ return detail::generate_ge(wd, weekday(x), x);
}
template <typename Date>
- inline Date
+ BOOST_FORCEINLINE Date
operator >(month_day md, Date d)
{
Date res;
@@ -99,7 +104,7 @@
return res;
}
template <typename Date>
- inline Date
+ BOOST_FORCEINLINE Date
operator >=(month_day md, Date d)
{
Date res;
@@ -110,15 +115,13 @@
}
template <typename Date>
- inline Date
+ BOOST_FORCEINLINE Date
operator >(nth n, Date d)
{
- std::cout << __FILE__<<"["<<__LINE__ <<"] "<< d << '\n';
Date res;
if (month(d)==dec)
{ // dec and jan have 31 days
res = Date(year(d),month(d),n.value());
- std::cout << __FILE__<<"["<<__LINE__ <<"] "<< res << '\n';
if (res > d) return res;
return Date(year(d),jan,n.value());
@@ -132,13 +135,11 @@
}
// nth <= 28 is always valid, so the next is either in this month or the next one
res = Date(year(d),month(d),n.value());
- std::cout << __FILE__<<"["<<__LINE__ <<"] "<< res << '\n';
if (res > d) return res;
- 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
+ BOOST_FORCEINLINE Date
operator >=(nth n, Date d)
{
Date res;
@@ -168,12 +169,12 @@
private:
Constraint constraint_;
public:
- explicit forward_generator(Constraint constraint)
+ explicit BOOST_FORCEINLINE forward_generator(Constraint constraint)
: constraint_(constraint)
{
}
template <typename Date>
- Date operator()(Date d)
+ BOOST_FORCEINLINE Date operator()(Date d)
{
return constraint_ > d;
}
@@ -185,12 +186,12 @@
Constraint constraint_;
Date dt_;
public:
- explicit forward_range(Constraint constraint, Date dt)
+ BOOST_FORCEINLINE explicit forward_range(Constraint constraint, Date dt)
: constraint_(constraint),
dt_(dt)
{
}
- Date operator()()
+ BOOST_FORCEINLINE Date operator()()
{
dt_ = constraint_ > dt_;
return dt_;
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -43,7 +43,7 @@
// Store x. Total 32 bits
boost::uint_least32_t x_;
- static BOOST_CONSTEXPR bool is_valid_(boost::uint_least32_t x) BOOST_NOEXCEPT
+ static BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid_(boost::uint_least32_t x) BOOST_NOEXCEPT
{
return x >= 11322 && x <= 23947853;
}
@@ -53,7 +53,7 @@
* 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.
*/
- BOOST_CONSTEXPR days_date() BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR days_date() BOOST_NOEXCEPT
: x_(11979588)
{
}
@@ -120,7 +120,7 @@
* @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)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR explicit days_date(days d, check_t)
: x_(
is_valid_(d.count())
? d.count()
@@ -128,12 +128,12 @@
)
{}
#else
- explicit days_date(days d, check_t)
+ BOOST_FORCEINLINE explicit days_date(days d, check_t)
: x_(d.count())
{
if (!is_valid())
{
- throw_exception( bad_date("days " + to_string(d.count()) + " is out of range") );
+ throw bad_date("days " + to_string(d.count()) + " is out of range") ;
}
}
#endif
@@ -144,7 +144,7 @@
* @Note This function doesn't check the parameters validity.
* It is up to the user to provide a valid ones.
*/
- BOOST_CONSTEXPR explicit days_date(days d) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR explicit days_date(days d) BOOST_NOEXCEPT
: x_(d.count())
{
}
@@ -227,7 +227,7 @@
/**
* @return @c true if the stored days are in the range [11322,23947853].
*/
- BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
{
return is_valid_(x_);
}
@@ -235,7 +235,7 @@
/**
* @Returns: the number of days since an undefined epoch.
*/
- BOOST_CONSTEXPR days days_since_epoch() BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR days days_since_epoch() BOOST_NOEXCEPT
{
return days(x_);
}
@@ -245,7 +245,7 @@
*
* @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
*/
- chrono::day to_day() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::day to_day() const BOOST_NOEXCEPT
{
return chrono::day(day_from_day_number());
}
@@ -261,7 +261,7 @@
*
* @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
*/
- chrono::month to_month() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::month to_month() const BOOST_NOEXCEPT
{
return chrono::month(month_from_day_number());
}
@@ -277,7 +277,7 @@
*
* @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
*/
- chrono::year to_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::year to_year() const BOOST_NOEXCEPT
{
return chrono::year(year_from_day_number());
}
@@ -293,7 +293,7 @@
*
* @Notes this function needs a conversion to @c ymd_date, so maybe you would do better to not use it.
*/
- bool to_is_leap_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE bool to_is_leap_year() const BOOST_NOEXCEPT
{
return leap_from_day_number();
}
@@ -321,7 +321,7 @@
* @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 to_weekday() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::weekday to_weekday() const BOOST_NOEXCEPT
{
return chrono::weekday((x_ + 1) % weekday::size);
}
@@ -331,7 +331,7 @@
* 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
+ BOOST_FORCEINLINE BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::weekday() const BOOST_NOEXCEPT
{
return to_weekday();
}
@@ -350,7 +350,7 @@
* @Effects: <c>*this += days(1)</c>.
* @Returns: <c>*this</c>.
*/
- days_date& operator++()
+ BOOST_FORCEINLINE days_date& operator++()
{
return *this += days(1);
}
@@ -358,7 +358,7 @@
* @Effects: <c>*this += days(1)</c>.
* @Returns: A copy of @c *this prior to the increment.
*/
- days_date operator++(int)
+ BOOST_FORCEINLINE days_date operator++(int)
{
days_date tmp(*this);
++(*this);
@@ -368,7 +368,7 @@
* @Effects: <c>*this += -d</c>.
* @Returns: <c>*this</c>.
*/
- days_date& operator-=(days d)
+ BOOST_FORCEINLINE days_date& operator-=(days d)
{
return *this += -d;
}
@@ -376,7 +376,7 @@
* @Effects: <c>*this -= days(1)</c>.
* @Returns: <c>*this</c>.
*/
- days_date& operator--()
+ BOOST_FORCEINLINE days_date& operator--()
{
return *this -= days(1);
}
@@ -384,7 +384,7 @@
* @Effects: <c>*this -= days(1)</c>.
* @Returns: A copy of @c *this prior to the increment.
*/
- days_date operator--(int)
+ BOOST_FORCEINLINE days_date operator--(int)
{
days_date tmp(*this); --(*this); return tmp;
}
@@ -393,7 +393,7 @@
* @Returns: <c>dt += d</c>.
*
*/
- friend BOOST_CONSTEXPR days_date operator+(days_date dt, days d)
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR days_date operator+(days_date dt, days d)
{
return days_date(dt.days_since_epoch()+d);
}
@@ -401,7 +401,7 @@
* @Returns: <c>dt += d</c>.
*
*/
- friend BOOST_CONSTEXPR days_date operator+(days d, days_date dt)
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR days_date operator+(days d, days_date dt)
{
return days_date(dt.days_since_epoch()+d);
}
@@ -409,7 +409,7 @@
* @Returns: <c>dt -= d</c>.
*
*/
- friend BOOST_CONSTEXPR days_date operator-(days_date dt, days d)
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR days_date operator-(days_date dt, days d)
{
return days_date(dt.days_since_epoch()-d);
}
@@ -417,7 +417,7 @@
* @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 BOOST_CONSTEXPR days operator-(days_date x, days_date y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR days operator-(days_date x, days_date y) BOOST_NOEXCEPT
{
return x.days_since_epoch() - y.days_since_epoch();
}
@@ -531,42 +531,42 @@
/**
* Returns: <c>x.days_since_epoch() == y.days_since_epoch()</c>.
*/
- friend BOOST_CONSTEXPR bool operator==(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE 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 BOOST_CONSTEXPR bool operator< (const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE 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 BOOST_CONSTEXPR bool operator!=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator!=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
{
return !(x == y);
}
/**
* @Returns: <c>y < x</c>.
*/
- friend BOOST_CONSTEXPR bool operator> (const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator> (const days_date& x, const days_date& y) BOOST_NOEXCEPT
{
return y < x;
}
/**
* @Returns: <c>!(y < x)</c>.
*/
- friend BOOST_CONSTEXPR bool operator<=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator<=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
{
return !(y < x);
}
/**
* @Returns: <c>!(x < y)</c>.
*/
- friend BOOST_CONSTEXPR bool operator>=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator>=(const days_date& x, const days_date& y) BOOST_NOEXCEPT
{
return !(x < y);
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -33,10 +33,29 @@
BOOST_STATIC_CONSTEXPR std::size_t size=last_-first_+1; // :5 bits
private:
- static BOOST_CONSTEXPR bool is_valid_(int v) BOOST_NOEXCEPT
+ static BOOST_CONSTEXPR BOOST_FORCEINLINE bool is_valid_(int v) BOOST_NOEXCEPT
{
return (first_ <= v && v <= last_);
}
+#ifndef BOOST_NO_CXX11_CONSTEXPR
+ static BOOST_CONSTEXPR BOOST_FORCEINLINE int check_invariants(int v)
+ {
+ return is_valid_(v)
+ ? v
+ : throw std::out_of_range("bounded " + chrono::to_string(int(v)) + " is out of range " +
+ chrono::to_string(first_) + ".." + chrono::to_string(last_)
+ )
+ ;
+ }
+#else
+ static BOOST_CONSTEXPR BOOST_FORCEINLINE int check_invariants(int v) BOOST_NOEXCEPT
+ {
+ if (is_valid_(v))
+ return v;
+ else
+ throw std::out_of_range("bounded " + boost::chrono::to_string(int(v)) + " is out of range");
+ }
+#endif
public:
/**
@@ -45,36 +64,23 @@
* @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
- BOOST_CONSTEXPR explicit bounded(int d, check_t)
- : value_(
- is_valid_(d)
- ? d
- : throw std::out_of_range("bounded " + boost::chrono::to_string(int(d)) + " is out of range")
- )
+ BOOST_FORCEINLINE BOOST_CONSTEXPR explicit bounded(int d, check_t)
+ : value_(check_invariants(d))
{}
-#else
- BOOST_CONSTEXPR explicit bounded(int d, check_t)
- : value_(d)
- {
- if (!is_valid_(d))
- throw std::out_of_range("bounded " + boost::chrono::to_string(int(d)) + " is out of range");
- }
-#endif
/**
* @Effects: Constructs an object of class @c bounded by storing @c d.
* @Postconditions: <c>value() == d</c>.
* @Note This function doesn't check the parameters validity.
* It is up to the user to provide a valid ones.
*/
- BOOST_CONSTEXPR bounded(int d) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bounded(int d) BOOST_NOEXCEPT
: value_(d)
{}
/**
* @Return if the stored value is a valid one.
*/
- BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
{
return is_valid_(value_);
}
@@ -82,7 +88,7 @@
* @Requires @c is_valid()
* @Returns the underlying value of that bounded.
*/
- BOOST_CONSTEXPR operator int() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR operator int() const BOOST_NOEXCEPT
{
return value_;
}
@@ -90,35 +96,35 @@
* @Requires @c is_valid()
* @Returns: the underlying value of that bounded.
*/
- BOOST_CONSTEXPR int value() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR int value() const BOOST_NOEXCEPT
{
return value_;
}
/**
* @Returns: the min valid value for a bounded of a month.
*/
- static BOOST_CONSTEXPR bounded min BOOST_PREVENT_MACRO_SUBSTITUTION () BOOST_NOEXCEPT
+ static BOOST_FORCEINLINE BOOST_CONSTEXPR bounded min BOOST_PREVENT_MACRO_SUBSTITUTION () BOOST_NOEXCEPT
{
return bounded(first_);
}
/**
* @Returns: the max valid value for a bounded of a month.
*/
- static BOOST_CONSTEXPR bounded max BOOST_PREVENT_MACRO_SUBSTITUTION () BOOST_NOEXCEPT
+ static BOOST_FORCEINLINE BOOST_CONSTEXPR bounded max BOOST_PREVENT_MACRO_SUBSTITUTION () BOOST_NOEXCEPT
{
return bounded(last_);
}
/**
* @Returns: the first bounded.
*/
- static BOOST_CONSTEXPR bounded first() BOOST_NOEXCEPT
+ static BOOST_FORCEINLINE BOOST_CONSTEXPR bounded first() BOOST_NOEXCEPT
{
return bounded(first_);
}
/**
* @Returns: the first bounded.
*/
- static BOOST_CONSTEXPR bounded last() BOOST_NOEXCEPT
+ static BOOST_FORCEINLINE BOOST_CONSTEXPR bounded last() BOOST_NOEXCEPT
{
return bounded(last_);
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -36,7 +36,7 @@
* @Effects: Constructs an object of class month by storing m.
* @Postconditions: static_cast<int>(*this) == m.
*/
- BOOST_CONSTEXPR explicit month(int m) :
+ BOOST_FORCEINLINE BOOST_CONSTEXPR explicit month(int m) :
base_type(m)
{
}
@@ -46,14 +46,14 @@
* @Postconditions: static_cast<int>(*this) == m.
* @Throws: if m is outside of the supported range, throws an exception of type bad_date.
*/
- BOOST_CONSTEXPR month(int m, check_t) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR month(int m, check_t) BOOST_NOEXCEPT
: base_type(m, check)
{}
/**
* @Return the number of days of the month depending on the @c is_leap_year parameter.
*/
- days days_in(bool is_leap_year) const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE days days_in(bool is_leap_year) const BOOST_NOEXCEPT
{
return days(days_in_month(is_leap_year, value()));
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -15,10 +15,10 @@
namespace chrono
{
-// struct no_check_t
-// {};
-// BOOST_CONSTEXPR_OR_CONST no_check_t no_check =
-// {};
+ struct no_check_t
+ {};
+ BOOST_CONSTEXPR_OR_CONST no_check_t no_check =
+ {};
struct check_t
{};
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -23,7 +23,7 @@
struct nth_tag
{
const int value_;
- BOOST_CONSTEXPR nth_tag(int v) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth_tag(int v) BOOST_NOEXCEPT
: value_(v)
{}
};
@@ -49,22 +49,22 @@
* @Effects: Constructs an object of class @c nth by storing @c s.
* Throws: if @c s is outside of the range [1, 6], throws an exception of type bad_date.
*/
- BOOST_CONSTEXPR nth(int s, check_t) : base_type(s, check)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth(int s, check_t) : base_type(s, check)
{}
/**
* @Effects: Constructs an object of class @c nth by storing @c s.
* @Note This function doesn't check the parameters validity.
* It is up to the user to provide a valid ones.
*/
- BOOST_CONSTEXPR nth(int s) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth(int s) BOOST_NOEXCEPT
: base_type(s)
{}
- BOOST_CONSTEXPR nth(nth_tag s) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth(nth_tag s) BOOST_NOEXCEPT
: base_type(s.value_)
{}
- BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
{
return value()==not_applicable;
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -33,27 +33,27 @@
public:
BOOST_STATIC_CONSTEXPR rep not_applicable=7;
- BOOST_CONSTEXPR nth_week() : base_type(not_applicable) {}
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth_week() : base_type(not_applicable) {}
/**
* @Effects: Constructs an object of class @c nth_week by storing @c s.
* Throws: if @c s is outside of the range [1, 6], throws an exception of type bad_date.
*/
- BOOST_CONSTEXPR nth_week(int s, check_t) : base_type(s, check)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth_week(int s, check_t) : base_type(s, check)
{}
/**
* @Effects: Constructs an object of class @c nth_week by storing @c s.
* @Note This function doesn't check the parameters validity.
* It is up to the user to provide a valid ones.
*/
- BOOST_CONSTEXPR nth_week(int s) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth_week(int s) BOOST_NOEXCEPT
: base_type(s)
{}
- BOOST_CONSTEXPR nth_week(nth_tag s) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR nth_week(nth_tag s) BOOST_NOEXCEPT
: base_type(s.value_)
{}
- BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
{
return value()==not_applicable;
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -38,17 +38,17 @@
* @Postconditions static_cast<int>(*this) == v
* @Throws if v is outside of the range [0, 6], throws an exception of type bad_date.
*/
- BOOST_CONSTEXPR weekday(int s, check_t) : base_type(s, check)
+ BOOST_FORCEINLINE BOOST_CONSTEXPR weekday(int s, check_t) : base_type(s, check)
{}
/**
* @Effects Constructs an object of class weekday by storing v.
* @Postconditions static_cast<int>(*this) == v
*/
- BOOST_CONSTEXPR weekday(int s) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR weekday(int s) BOOST_NOEXCEPT
: base_type(s)
{}
- BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_not_applicable() const BOOST_NOEXCEPT
{
return value()==not_applicable;
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -98,7 +98,7 @@
* Constructs a ydoy_date for which days_since_epoch() == y.days_since_epoch()+doy
* @Throws bad_date if the specified ydoy_date is invalid.
*/
- BOOST_CHRONO_DATE_CONSTEXPR ydoy_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ydoy_date(chrono::year y, day_of_year doy) BOOST_NOEXCEPT
: y_(y),
doy_(doy),
leap_(is_leap(y_))
@@ -144,7 +144,7 @@
* 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.
*/
- BOOST_CONSTEXPR ydoy_date() BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR ydoy_date() BOOST_NOEXCEPT
:
y_(0),
doy_(1),
@@ -172,7 +172,7 @@
// // explicit
// operator system_clock::time_point () const;
- BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
{
// @todo add check on valid day_of_year and leap year.
return chrono::year(y_).is_valid() && day_of_year(doy_).is_valid();
@@ -181,14 +181,14 @@
/**
* @Returns: the number of days since an undefined epoch.
*/
- days to_days_since_epoch() const
+ BOOST_FORCEINLINE days to_days_since_epoch() const
{
return days(days_before_year(y_+32799)+doy_-1);
}
/**
* @Returns: the number of days since an undefined epoch.
*/
- days days_since_epoch() const
+ BOOST_FORCEINLINE days days_since_epoch() const
{
return days(days_before_year(y_+32799)+doy_-1);
}
@@ -198,7 +198,7 @@
*
* @Effects stores a year and days_of_year that represents the same date as the @c dt @c days_date parameter.
*/
- explicit ydoy_date(days_date dt);
+ explicit BOOST_FORCEINLINE ydoy_date(days_date dt);
//#if ! defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
/**
* Explicit conversion to @c days_date.
@@ -206,7 +206,7 @@
* @Returns a @c days_date representing the same date.
*/
//BOOST_CHRONO_EXPLICT
- operator days_date() const
+ BOOST_FORCEINLINE operator days_date() const
{
year::rep by = y_ + 32799;
return days_date(days(days_before_year(by) + doy_ - 1));
@@ -218,7 +218,7 @@
*
* @Returns a @c days_date representing the same date.
*/
- friend days_date to_days_date(ydoy_date ydoy)
+ friend BOOST_FORCEINLINE days_date to_days_date(ydoy_date ydoy)
{
year::rep by = ydoy.y_ + 32799;
return days_date(days(days_before_year(by) + ydoy.doy_ - 1));
@@ -237,7 +237,7 @@
*
* @Returns a @c ymd_date representing the same date.
*/
- BOOST_CHRONO_EXPLICT operator ymd_date() const
+ BOOST_CHRONO_EXPLICT BOOST_FORCEINLINE operator ymd_date() const
{
//return days_date(chrono::year(y_), day_of_year(doy_));
return ymd_date(to_days_date(*this));
@@ -248,7 +248,7 @@
*
* @Returns a @c ymd_date representing the same date.
*/
- friend ymd_date to_ymd_date(ydoy_date ydoy)
+ friend BOOST_FORCEINLINE ymd_date to_ymd_date(ydoy_date ydoy)
{
return ymd_date(to_days_date(ydoy));
}
@@ -272,7 +272,7 @@
/**
* @Returns: chrono::month(m_).
*/
- chrono::month to_month() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::month to_month() const BOOST_NOEXCEPT
{
return chrono::month(day_of_year_month(leap_,doy_));
}
@@ -286,7 +286,7 @@
/**
* @Returns: chrono::year(y_).
*/
- BOOST_CONSTEXPR chrono::year to_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::year to_year() const BOOST_NOEXCEPT
{
return chrono::year(y_);
}
@@ -294,33 +294,33 @@
* @Returns: chrono::year(y_).
*/
//BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
{
return chrono::year(y_);
}
- chrono::month_day month_day() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::month_day month_day() const BOOST_NOEXCEPT
{
return chrono::month_day(chrono::month(day_of_year_month(leap_,doy_)), chrono::day(day_of_year_day_of_month(leap_,doy_)));
}
- chrono::year_month year_month() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::year_month year_month() const BOOST_NOEXCEPT
{
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
+ BOOST_FORCEINLINE 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: true if year() is a leap year, and otherwise returns false.
*/
- BOOST_CONSTEXPR bool to_is_leap_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool to_is_leap_year() const BOOST_NOEXCEPT
{
return leap_;
}
/**
* @Returns: true if year() is a leap year, and otherwise returns false.
*/
- BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
{
return leap_;
}
@@ -329,7 +329,7 @@
* @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).
*/
- chrono::weekday to_weekday() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::weekday to_weekday() const BOOST_NOEXCEPT
{
return chrono::weekday((days_since_epoch()+days(1)).count() % chrono::weekday::size);
}
@@ -536,14 +536,14 @@
/**
* @Returns: x.days_since_epoch() == y.days_since_epoch()
*/
- friend BOOST_CONSTEXPR bool operator==(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE 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 BOOST_CONSTEXPR bool operator< (const ydoy_date& x, const ydoy_date& y)
+ friend BOOST_FORCEINLINE 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_));
@@ -551,28 +551,28 @@
/**
* @Returns: !(x == y).
*/
- friend BOOST_CONSTEXPR bool operator!=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator!=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
{
return !(x == y);
}
/**
* @Returns: y < x.
*/
- friend BOOST_CONSTEXPR bool operator> (const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator> (const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
{
return y < x;
}
/**
* @Returns: !(y < x).
*/
- friend BOOST_CONSTEXPR bool operator<=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator<=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
{
return !(y < x);
}
/**
* @Returns: !(x < y).
*/
- friend BOOST_CONSTEXPR bool operator>=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator>=(const ydoy_date& x, const ydoy_date& y) BOOST_NOEXCEPT
{
return !(x < y);
}
@@ -605,7 +605,7 @@
* @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)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(chrono::year y, day_of_year d)
{
return ydoy_date(y, d);
}
@@ -613,7 +613,7 @@
* @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)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(day_of_year d, chrono::year y)
{
return ydoy_date(y, d);
}
@@ -621,7 +621,7 @@
* @c ydoy_date factory.
* @Returns @c y/day_of_year(d)
*/
- inline BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(chrono::year y, int d)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(chrono::year y, int d)
{
return y / day_of_year(d);
}
@@ -629,7 +629,7 @@
* @c ydoy_date factory.
* @Returns @c d/chrono::year(y)
*/
- inline BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(day_of_year d, int y)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ydoy_date operator/(day_of_year d, int y)
{
return d / chrono::year(y);
}
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -42,11 +42,8 @@
* @Effects: Constructs an object of class year by storing y.
* @Postconditions: static_cast<int>(*this) == y.
*/
- BOOST_CONSTEXPR explicit year(int v) :
+ BOOST_FORCEINLINE BOOST_CONSTEXPR explicit year(int v) :
base_type(v)
-
- //is_leap_(false),
- //is_leap_initialized_(false)
{
}
@@ -55,16 +52,14 @@
* @Postconditions: static_cast<int>(*this) == y.
* @Throws: if y is outside of the supported range, throws an exception of type bad_date.
*/
- year(int y, check_t) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR 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.
*/
- BOOST_CONSTEXPR days days_in() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR days days_in() const BOOST_NOEXCEPT
{
return days(365+days::rep(is_leap()));
}
@@ -72,7 +67,7 @@
/**
* @Return the number of days of the month parameter in this year.
*/
- days days_in_month(month m) const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE days days_in_month(month m) const BOOST_NOEXCEPT
{
return m.days_in(is_leap());
}
@@ -80,7 +75,7 @@
/**
* @Return the number of days since the epoch until the fist day of this year.
*/
- inline days days_since_epoch() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE days days_since_epoch() const BOOST_NOEXCEPT
{
return days(days_before_year(value()));
}
@@ -88,25 +83,15 @@
/**
* @Return whether this year is leap or not.
*/
- BOOST_CONSTEXPR bool is_leap() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_leap() const BOOST_NOEXCEPT
{
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
+ static BOOST_FORCEINLINE BOOST_CONSTEXPR year zero() BOOST_NOEXCEPT
{
return year(0);
}
- private:
- // 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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -34,6 +34,21 @@
namespace chrono
{
+ namespace chrono_detail
+ {
+#ifndef BOOST_NO_CXX11_CONSTEXPR
+ BOOST_STATIC_CONSTEXPR day::rep max_days_in_month_[13] =
+ { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ BOOST_FORCEINLINE static BOOST_CONSTEXPR
+ day::rep max_days_in_month(int d) { return max_days_in_month_[d]; }
+#else
+ extern day::rep max_days_in_month_[];
+ BOOST_FORCEINLINE static
+ day::rep max_days_in_month(int d) { return max_days_in_month_[d]; }
+
+#endif
+
+ }
/**
* The class @c ymd_date is a model of Date storing
* - the @c year,
@@ -81,9 +96,44 @@
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);
+
+#ifndef BOOST_NO_CXX11_CONSTEXPR
+ BOOST_FORCEINLINE static BOOST_CHRONO_DATE_CONSTEXPR
+ day check_invariants(year y, month m, day d)
+ {
+ return (m != 2)
+ ? ( d <= chrono_detail::max_days_in_month(m)
+ ? d
+ : throw bad_date("day " + to_string(d) + " is out of range for " + to_string(y) + '/' + to_string(m))
+ )
+ : ( y.is_leap()
+ ? ( d <= 29
+ ? d
+ : throw bad_date("day " + to_string(d) + " is out of range for " + to_string(y) + '/' + to_string(m))
+ )
+ : ( d <= 28
+ ? d
+ : throw bad_date("day " + to_string(d) + " is out of range for " + to_string(y) + '/' + to_string(m))
+ )
+ );
+ }
+#else
+ BOOST_FORCEINLINE static
+ day check_invariants(year y, month m, day d)
+ {
+ if ( m != 2 )
+ if ( d <= chrono_detail::max_days_in_month(m) ) return d;
+ else throw bad_date("day " + to_string(d) + " is out of range for " + to_string(y) + '/' + to_string(m));
+ else
+ if (y.is_leap())
+ if ( d <= 29 ) return d;
+ else throw bad_date("day " + to_string(d) + " is out of range for " + to_string(y) + '/' + to_string(m));
+ else
+ if (d <= 28) return d;
+ else throw bad_date("day " + to_string(d) + " is out of range for " + to_string(y) + '/' + to_string(m));
+ }
+#endif
+
#endif
/**
* @Effect Constructs a @c ymd_date using the @c year, @c month, @c day stored in the arguments as follows:
@@ -93,35 +143,50 @@
* @Throws @c bad_date if the specified @c ymd_date is invalid.
*/
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)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, chrono::day d, check_t):
+ y_(y),
+ m_(m),
+ d_(check_invariants(y, m, d))
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
{
- ymd_date_c(y,m,d, check);
}
- ymd_date(chrono::year y, chrono::month m, int d, check_t)
+ ymd_date(int y, chrono::month m, chrono::day d, check_t):
+ y_(y),
+ m_(m),
+ d_(check_invariants(year(y), m, d))
+ #if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+ #endif
+ {
+ }
+ ymd_date(chrono::year y, int m, chrono::day d, check_t):
+ y_(y),
+ m_(m),
+ d_(check_invariants(y, month(m), d))
+ #if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+ #endif
+ {
+ }
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, int d, check_t):
+ y_(y),
+ m_(m),
+ d_(check_invariants(y, m, day(d)))
+#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
+ , leap_(boost::chrono::is_leap(y_))
+#endif
{
- 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>year() == y && month() = m && day() == d</c>.
*/
public:
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, chrono::day d) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, chrono::day d) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -130,7 +195,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int y, chrono::month m, chrono::day d) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int y, chrono::month m, chrono::day d) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -139,7 +204,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, int m, chrono::day d) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, int m, chrono::day d) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -148,7 +213,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, int d) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::year y, chrono::month m, int d) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -158,7 +223,7 @@
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, chrono::day d, chrono::year y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, chrono::day d, chrono::year y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -167,7 +232,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, chrono::day d, int y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, chrono::day d, int y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -176,7 +241,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, int d, chrono::year y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::month m, int d, chrono::year y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -185,7 +250,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int m, chrono::day d, chrono::year y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int m, chrono::day d, chrono::year y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -194,7 +259,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, chrono::month m, chrono::year y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, chrono::month m, chrono::year y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -203,7 +268,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, chrono::month m, int y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, chrono::month m, int y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -212,7 +277,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, int m, chrono::year y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(chrono::day d, int m, chrono::year y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -221,7 +286,7 @@
#endif
{
}
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int d, chrono::month m, chrono::year y) BOOST_NOEXCEPT :
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date(int d, chrono::month m, chrono::year y) BOOST_NOEXCEPT :
y_(y),
m_(m),
d_(d)
@@ -276,7 +341,7 @@
/**
* Unchecked constructor from days+ymd+leap
*/
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(days::rep, year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE 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),
@@ -289,7 +354,7 @@
/**
* Unchecked constructor from ymd+leap
*/
- BOOST_CHRONO_DATE_CONSTEXPR ymd_date(year::rep y, month::rep m, day::rep d, bool leap) BOOST_NOEXCEPT
+ BOOST_FORCEINLINE 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)
@@ -326,7 +391,7 @@
* 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.
*/
- BOOST_CONSTEXPR ymd_date() BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR ymd_date() BOOST_NOEXCEPT
:
y_(0),
m_(1),
@@ -404,7 +469,7 @@
* Conversion to @c days_date
*/
//BOOST_CHRONO_EXPLICT
- operator days_date() const
+ BOOST_FORCEINLINE operator days_date() const BOOST_NOEXCEPT
{
return days_date(days(day_number_from_ymd()));
}
@@ -412,7 +477,7 @@
/**
* Returns: chrono::day(d_).
*/
- BOOST_CONSTEXPR chrono::day to_day() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::day to_day() const BOOST_NOEXCEPT
{
return chrono::day(d_);
}
@@ -420,14 +485,14 @@
* Returns: chrono::day(d_).
*/
//BOOST_CONSTEXPR chrono::day day() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::day() const BOOST_NOEXCEPT
{
return chrono::day(d_);
}
/**
* Returns: chrono::month(m_).
*/
- BOOST_CONSTEXPR chrono::month to_month() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::month to_month() const BOOST_NOEXCEPT
{
return chrono::month(m_);
}
@@ -435,14 +500,14 @@
* Returns: chrono::month(m_).
*/
//BOOST_CONSTEXPR chrono::month month() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::month() const BOOST_NOEXCEPT
{
return chrono::month(m_);
}
/**
* Returns: chrono::year(y_).
*/
- BOOST_CONSTEXPR chrono::year to_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::year to_year() const BOOST_NOEXCEPT
{
return chrono::year(y_);
}
@@ -450,26 +515,26 @@
* Returns: chrono::year(y_).
*/
//BOOST_CONSTEXPR chrono::year year() const BOOST_NOEXCEPT
- BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CHRONO_EXPLICT BOOST_CONSTEXPR operator chrono::year() const BOOST_NOEXCEPT
{
return chrono::year(y_);
}
- chrono::month_day get_month_day() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::month_day get_month_day() const BOOST_NOEXCEPT
{
return chrono::month_day(chrono::month(m_), chrono::day(d_));
}
- chrono::year_month get_year_month() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::year_month get_year_month() const BOOST_NOEXCEPT
{
return chrono::year_month(chrono::year(y_),chrono::month(m_));
}
- chrono::year_month_day get_year_month_day() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR chrono::year_month_day get_year_month_day() const BOOST_NOEXCEPT
{
return chrono::year_month_day(chrono::year(y_),chrono::month(m_),chrono::day(d_));
}
/**
* Returns: whether year() is a leap year.
*/
- BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_leap_year() const BOOST_NOEXCEPT
{
#if defined BOOST_CHRONO_DATE_YMD_DATE_HAS_LEAP_FIELD
return leap_;
@@ -485,7 +550,7 @@
* @Notes this function needs a conversion to @c days_date, so maybe you would do better to not use it.
*
*/
- chrono::weekday to_weekday() const BOOST_NOEXCEPT
+ BOOST_FORCEINLINE chrono::weekday to_weekday() const BOOST_NOEXCEPT
{
return chrono::weekday((day_number_from_ymd()+1) % chrono::weekday::size);
}
@@ -618,7 +683,7 @@
* @Returns: dt += m.
*
*/
- friend ymd_date operator+(ymd_date dt, months m)
+ friend BOOST_FORCEINLINE ymd_date operator+(ymd_date dt, months m)
{
dt += m;
return dt;
@@ -627,7 +692,7 @@
* @Returns: dt += m.
*
*/
- friend ymd_date operator+(months m, ymd_date dt)
+ friend BOOST_FORCEINLINE ymd_date operator+(months m, ymd_date dt)
{
dt += m;
return dt;
@@ -636,7 +701,7 @@
* @Returns: dt += -m.
*
*/
- friend ymd_date operator-(ymd_date dt, months m)
+ friend BOOST_FORCEINLINE ymd_date operator-(ymd_date dt, months m)
{
dt -= m;
return dt;
@@ -670,7 +735,7 @@
* @Returns: dt += y.
*
*/
- friend ymd_date operator+(ymd_date dt, years y)
+ friend BOOST_FORCEINLINE ymd_date operator+(ymd_date dt, years y)
{
dt += y;
return dt;
@@ -679,7 +744,7 @@
* @Returns: dt += y.
*
*/
- friend ymd_date operator+(years y, ymd_date dt)
+ friend BOOST_FORCEINLINE ymd_date operator+(years y, ymd_date dt)
{
dt += y;
return dt;
@@ -688,7 +753,7 @@
* @Returns: dt -= y.
*
*/
- friend ymd_date operator-(ymd_date dt, years y)
+ friend BOOST_FORCEINLINE ymd_date operator-(ymd_date dt, years y)
{
dt -= y;
return dt;
@@ -697,14 +762,14 @@
/**
* Returns: x.year() == y.year() && x.month() == y.month() && x.day() == y.day()
*/
- friend BOOST_CONSTEXPR bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR 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_;
}
/**
* Returns: x.year_month_day() < y.year_month_day() in lexicographic order.
*/
- friend BOOST_CONSTEXPR bool operator< (const ymd_date& x, const ymd_date& y)
+ friend BOOST_FORCEINLINE 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_ ||
@@ -714,28 +779,28 @@
/**
* @Returns: !(x == y).
*/
- friend BOOST_CONSTEXPR bool operator!=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator!=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
{
return !(x == y);
}
/**
* @Returns: y < x.
*/
- friend BOOST_CONSTEXPR bool operator> (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator> (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
{
return y < x;
}
/**
* @Returns: !(y < x).
*/
- friend BOOST_CONSTEXPR bool operator<=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator<=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
{
return !(y < x);
}
/**
* @Returns: !(x < y).
*/
- friend bool operator>=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
+ friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator>=(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT
{
return !(x < y);
}
@@ -777,7 +842,7 @@
* @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)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(year_month ym, day d)
{
return ymd_date(year(ym), month(ym), d);
}
@@ -785,7 +850,7 @@
* @c ymd_date factory.
* @Returns @c ym/day(d)
*/
- inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(year_month ym, int d)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(year_month ym, int d)
{
return ym / day(d);
}
@@ -793,7 +858,7 @@
* @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)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(month_day md, year y)
{
return ymd_date(y, month(md), day(md));
}
@@ -801,7 +866,7 @@
* @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)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(year y, month_day md)
{
return ymd_date(y, month(md), day(md));
}
@@ -809,24 +874,24 @@
* @c ymd_date factory.
* @Returns @c md/year(y)
*/
- inline BOOST_CHRONO_DATE_CONSTEXPR ymd_date operator/(month_day md, int y)
+ BOOST_FORCEINLINE 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)
+ BOOST_FORCEINLINE 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)
+ BOOST_FORCEINLINE 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)
+ BOOST_FORCEINLINE 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)
+ BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR ymd_date make_date(int y,month m, day d)
{
return ymd_date(year(y), m, d);
}
Modified: sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp (original)
+++ sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -6,20 +6,6 @@
#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;
@@ -35,6 +21,52 @@
#define VOLATILE volatile
#define CHECK_IS_VALID(d)
+void empty_unchecked_ymd_dcl()
+{
+ 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 ymd_date dt = ymd_date(year(y), month(m), d);
+ (void)dt;
+ ++count;
+ }
+ }
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto encode = t1 - t0;
+ std::cout << "unchecked ymd " << sec(encode).count() / count << '\n';
+}
+void empty_checked_ymd_dcl()
+{
+ 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 ymd_date dt = ymd_date(year(y), month(m, check), day(d,check), check);
+ (void)dt;
+ ++count;
+ }
+ }
+ }
+ auto t1 = boost::chrono::high_resolution_clock::now();
+ typedef boost::chrono::duration<float, boost::nano> sec;
+ auto encode = t1 - t0;
+ std::cout << "checked ymd " << sec(encode).count() / count << '\n';
+}
void empty_encoding_perf()
{
@@ -55,7 +87,6 @@
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';
}
@@ -72,6 +103,7 @@
for (int d = 1; d <= last; ++d)
{
volatile days::rep ds = to_days(y, m, d);
+ (void)ds;
++count;
}
}
@@ -79,7 +111,6 @@
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';
}
@@ -96,6 +127,7 @@
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);
+ (void)ds;
++count;
}
}
@@ -103,7 +135,6 @@
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';
}
@@ -120,7 +151,7 @@
for (int d = 1; d <= last; ++d)
{
volatile days::rep ds = days_date(ymd_date(year(y), month(m), d)).days_since_epoch().count();
-
+ (void)ds;
++count;
}
}
@@ -128,7 +159,6 @@
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';
}
@@ -141,14 +171,14 @@
auto t0 = boost::chrono::high_resolution_clock::now();
for (int k = k0; k <= k1; ++k)
{
- VOLATILE days_date dt1((days(k)));
+ VOLATILE days_date dt((days(k)));
+ (void)dt;
++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()
@@ -168,7 +198,6 @@
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';
}
@@ -189,7 +218,6 @@
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';
}
@@ -210,13 +238,15 @@
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();
+ empty_checked_ymd_dcl();
+ empty_unchecked_ymd_dcl();
+ empty_encoding_perf();
raw_encoding_perf();
raw_space_encoding_perf();
class_encoding_perf();
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -166,25 +166,20 @@
}
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) +
+ return days_before_year(y - 32799) +
+ days_in_year_before(is_leap(y),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) +
+ return days_before_year(y - 32799) +
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) +
+ return days_before_year(static_cast<int_least32_t>(y - 32799)) +
+ days_in_year_before(is_leap(y),m-1) +
d;
}
Modified: sandbox/chrono_date/libs/date/src/vars.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/vars.cpp (original)
+++ sandbox/chrono_date/libs/date/src/vars.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -88,6 +88,15 @@
{ 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
};
+ namespace chrono_detail
+ {
+#ifndef BOOST_NO_CXX11_CONSTEXPR
+#else
+ day::rep max_days_in_month_[13] =
+ { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+#endif
+ }
+
// days year::days_in_month(month m) const BOOST_NOEXCEPT
// {
Modified: sandbox/chrono_date/libs/date/src/ymd_date.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/ymd_date.cpp (original)
+++ sandbox/chrono_date/libs/date/src/ymd_date.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -109,12 +109,6 @@
// return true;
// }
- 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(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(chrono::year y, chrono::month_day md, check_t)
{
if (set_if_valid_date(y, month(md), day(md))) return;
@@ -122,16 +116,6 @@
"day " + to_string(day(md)) + " is out of range for " + to_string(y) + '-' + to_string(month(md)));
}
- void ymd_date::ymd_date_c(chrono::year::rep y, chrono::month::rep m, chrono::day::rep d) BOOST_NOEXCEPT
- {
- 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(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
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -115,6 +115,18 @@
;
}
+rule date-run-2-fail ( sources + : name )
+{
+ return
+ [ run-fail $(sources) ../build//boost_chrono_date
+ : :
+ :
+ <library>/boost/chrono//boost_chrono
+ <library>/boost/system//boost_system
+ : $(name)_shared ]
+ ;
+}
+
test-suite "wrappers"
:
@@ -126,6 +138,9 @@
[ date-run-2 wrappers/week_pass.cpp : week_pass ]
[ date-run-2 wrappers/month_pass.cpp : month_pass ]
[ date-run-2 wrappers/year_pass.cpp : year_pass ]
+
+ #[ date-run-2-fail wrappers/day_of_year_fail.cpp : day_of_year_f ]
+
;
test-suite "dates"
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -20,12 +20,15 @@
typedef boost::chrono::high_resolution_clock Clock;
typedef boost::chrono::duration<double, boost::micro> micros;
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+
{ // construct from ymd: 0/1/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);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
// { // unchecked construct from bad ymd: 0/0/0 results in valid date
// days_date dt(year(0),month(0),day(0));
// std::cout <<"0/0/0 days "<< dt.days_since_epoch().count() << std::endl;
@@ -39,12 +42,16 @@
//
// 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_date dt(days(0), check);
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
BOOST_TEST( false );
} catch (...) {}
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // construct from days: 0/1/1
days_date dt(days(11979588));
BOOST_TEST( dt.is_valid());
@@ -53,6 +60,7 @@
BOOST_TEST(dt.to_month()==1);
BOOST_TEST(dt.to_day()==1);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // default constructor
days_date dt;
BOOST_TEST( dt.is_valid());
@@ -61,6 +69,7 @@
BOOST_TEST(dt.to_day()==1);
BOOST_TEST(dt.days_since_epoch().count()==11979588);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // construct from ymd: 2011/oct/22
//days_date dt(year(2011),oct,day(22), check);
days_date dt(oct/day(22)/2011);
@@ -69,6 +78,7 @@
BOOST_TEST(dt.to_month()==oct);
BOOST_TEST(dt.to_day()==22);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // no_check construct from bad ymd: 2011/oct/22
//days_date dt(year(2011),oct,day(22));
days_date dt(oct/day(22)/2011);
@@ -77,6 +87,7 @@
BOOST_TEST(dt.to_month()==oct);
BOOST_TEST(dt.to_day()==22);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // construct from ymd: 2011/jan_01
//days_date dt(year(2011),jan_01, check);
days_date dt(jan_01/2011);
@@ -85,6 +96,7 @@
BOOST_TEST(dt.to_month()==jan);
BOOST_TEST(dt.to_day()==1);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // no_check construct from ymd: 2011/jan_01
//days_date dt(year(2011),jan_01);
days_date dt(jan_01/2011);
@@ -93,6 +105,7 @@
BOOST_TEST(dt.to_month()==jan);
BOOST_TEST(dt.to_day()==1);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // construct from ymd: first day: -32768/jan_01
//days_date dt(year(-32768),jan_01);
days_date dt(jan_01/-32768);
@@ -158,6 +171,7 @@
BOOST_TEST(dt.to_month()==dec);
BOOST_TEST(dt.to_day()==31);
}
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{ // construct from bad (year + doy):
try {
Added: sandbox/chrono_date/libs/date/test/wrappers/day_of_year_fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono_date/libs/date/test/wrappers/day_of_year_fail.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -0,0 +1,40 @@
+// Copyright 2010 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/day_of_year.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ using namespace boost::chrono;
+
+#if ! defined BOOST_CHRONO_DATE_NO_CXX11_CONSTEXPR
+ {
+ try
+ {
+ day_of_year doy(0, check);
+ BOOST_TEST(false && "0 is not a valid day of year");
+ }
+ catch (...)
+ {
+ }
+ }
+ {
+ try
+ {
+ day_of_year doy(367, check);
+ BOOST_TEST(false && "367 is not a valid day of year");
+ }
+ catch (...)
+ {
+ }
+ }
+ return boost::report_errors();
+#else
+ // "Test non applicable when BOOST_NO_CXX11_CONSTEXPR is defined"
+ return 1;
+#endif //BOOST_NO_CXX11_CONSTEXPR
+
+}
Modified: sandbox/chrono_date/libs/date/test/wrappers/day_of_year_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/wrappers/day_of_year_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/wrappers/day_of_year_pass.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -10,6 +10,7 @@
{
using namespace boost::chrono;
+#if defined BOOST_NO_CXX11_CONSTEXPR
{
try
{
@@ -30,6 +31,7 @@
{
}
}
+#endif //BOOST_NO_CXX11_CONSTEXPR
{
day_of_year doy(0);
BOOST_TEST(!doy.is_valid() && "0 is not a valid day of year");
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-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -9,6 +9,7 @@
{
using namespace boost::chrono;
+#if defined BOOST_NO_CXX11_CONSTEXPR
{
try
{
@@ -29,6 +30,7 @@
{
}
}
+#endif
{
day d(0);
BOOST_TEST(!d.is_valid() && "0 is not a valid day");
Modified: sandbox/chrono_date/libs/date/test/wrappers/nth_week_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/wrappers/nth_week_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/wrappers/nth_week_pass.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -10,22 +10,17 @@
{
using namespace boost::chrono;
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+#if defined BOOST_NO_CXX11_CONSTEXPR
{
try
{
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
nth_week d(0, check);
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
BOOST_TEST(false && "0 is not a valid nth_week");
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
}
catch (...)
{
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
}
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
try
{
@@ -36,44 +31,37 @@
{
}
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
+#endif
{
nth_week d(0);
BOOST_TEST(!d.is_valid() && "0 is not a valid nth_week");
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
nth_week d(7);
BOOST_TEST(!d.is_valid() && "7 is not a valid nth_week");
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
nth_week d(-1);
BOOST_TEST(!d.is_valid() && "-1 is not a valid nth_week");
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
nth_week d(1);
BOOST_TEST(d.is_valid() && "1 is a valid nth_week");
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
nth_week d(5);
BOOST_TEST(d.is_valid() );
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
nth_week d(6);
BOOST_TEST(d.is_valid() );
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
nth_week d(2);
BOOST_TEST(d.is_valid() && "2 is a valid nth_week");
nth_week::rep i = d;
BOOST_TEST(i==2);
}
- std::cerr << __FILE__ << ":" << __LINE__ << " " << std::endl;
{
nth_week d(3);
BOOST_TEST(d.is_valid() && "3 is a valid nth_week");
Modified: sandbox/chrono_date/libs/date/test/wrappers/week_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/wrappers/week_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/wrappers/week_pass.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -10,6 +10,7 @@
{
using namespace boost::chrono;
+#if defined BOOST_NO_CXX11_CONSTEXPR
{
try
{
@@ -30,6 +31,7 @@
{
}
}
+#endif
{
week d(0);
BOOST_TEST(!d.is_valid() && "0 is not a valid week");
Modified: sandbox/chrono_date/libs/date/test/wrappers/weekday_pass.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/test/wrappers/weekday_pass.cpp (original)
+++ sandbox/chrono_date/libs/date/test/wrappers/weekday_pass.cpp 2013-05-12 09:15:26 EDT (Sun, 12 May 2013)
@@ -10,6 +10,7 @@
{
using namespace boost::chrono;
+#if defined BOOST_NO_CXX11_CONSTEXPR
{
try
{
@@ -30,6 +31,7 @@
{
}
}
+#endif
{
weekday d(-1);
BOOST_TEST(!d.is_valid() && "-1 is not a valid weekday");
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