From 241551dd6c3ffd4d83bb2b82989c18e0dcd911d2 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Tue, 27 Jun 2017 14:08:02 -0400 Subject: [PATCH] Allow day overflow in year_month_day to sys_days conversion --- d0355r4.html | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/d0355r4.html b/d0355r4.html index 6c46af5..0ed2350 100644 --- a/d0355r4.html +++ b/d0355r4.html @@ -6744,16 +6744,30 @@ constexpr year_month_day::operator sys_days() const noexcept;

-Requires: ok() == true. +Requires: y_.ok() && m_.ok() == true.

-Returns: A sys_days which represents the date represented by -*this. +Returns: If ok(), returns a sys_days +holding a count of days before or since the +sys_days epoch. Otherwise returns a +sys_days which is offset from +sys_days{y_/m_/last} by the number of days +d_ is offset from sys_days{y_/m_/last}.day().

Remarks: A sys_days which is converted to a year_month_day, -shall have the same value when converted back to a sys_days. The round -trip conversion sequence shall be loss-less. +shall have the same value when converted back to a sys_days. +

+

+[Example: +

+
+static_assert(year_month_day{sys_days{2017y/jan/0}}  == 2016y/dec/31);
+static_assert(year_month_day{sys_days{2017y/jan/31}} == 2017y/jan/31);
+static_assert(year_month_day{sys_days{2017y/jan/32}} == 2017y/feb/1);
+
+

+—end example]