Get off of day_point

This commit is contained in:
Howard Hinnant
2016-05-21 10:24:25 -04:00
parent 823176c1ea
commit 76c906d779
14 changed files with 68 additions and 114 deletions
+3 -3
View File
@@ -26,7 +26,7 @@
// public:
// explicit constexpr weekday(unsigned wd) noexcept;
// constexpr weekday(date::weekday wd) noexcept;
// constexpr weekday(const day_point& dp) noexcept;
// constexpr weekday(const sys_days& dp) noexcept;
//
// weekday& operator++() noexcept;
// weekday operator++(int) noexcept;
@@ -85,12 +85,12 @@ static_assert(std::is_standard_layout<iso_week::weekday>{}, "");
static_assert(std::is_literal_type<iso_week::weekday>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::weekday, unsigned>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::weekday, iso_week::day_point>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::weekday, iso_week::sys_days>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::weekday, date::weekday>{}, "");
static_assert( std::is_nothrow_constructible<date::weekday, iso_week::weekday>{}, "");
static_assert( std::is_nothrow_constructible<unsigned, iso_week::weekday>{}, "");
static_assert(!std::is_convertible<unsigned, iso_week::weekday>{}, "");
static_assert( std::is_convertible<iso_week::day_point, iso_week::weekday>{}, "");
static_assert( std::is_convertible<iso_week::sys_days, iso_week::weekday>{}, "");
static_assert( std::is_convertible<iso_week::weekday, date::weekday>{}, "");
static_assert( std::is_convertible<date::weekday, iso_week::weekday>{}, "");
static_assert(!std::is_convertible<iso_week::weekday, unsigned>{}, "");
+5 -5
View File
@@ -33,7 +33,7 @@
// constexpr iso_week::weeknum weeknum() const noexcept;
// constexpr iso_week::weekday weekday() const noexcept;
//
// constexpr operator day_point() const noexcept;
// constexpr operator sys_days() const noexcept;
// constexpr bool ok() const noexcept;
// };
//
@@ -69,10 +69,10 @@ static_assert(std::is_literal_type<iso_week::year_lastweek_weekday>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::year_lastweek_weekday,
iso_week::year, iso_week::weekday>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::day_point,
static_assert( std::is_nothrow_constructible<iso_week::sys_days,
iso_week::year_lastweek_weekday>{}, "");
static_assert( std::is_convertible<iso_week::year_lastweek_weekday,
iso_week::day_point>{}, "");
iso_week::sys_days>{}, "");
int
main()
@@ -100,8 +100,8 @@ main()
assert(x3.weeknum() == 53_w);
assert(x3.weekday() == tue);
constexpr day_point dp = 2015_y/last/wed;
static_assert(dp == day_point{days{16799}}, "");
constexpr sys_days dp = 2015_y/last/wed;
static_assert(dp == sys_days{days{16799}}, "");
static_assert(x0.ok(), "");
assert(x3.ok());
+9 -9
View File
@@ -28,7 +28,7 @@
// constexpr year_weeknum_weekday(const iso_week::year& y, const iso_week::weeknum& wn,
// const iso_week::weekday& wd) noexcept;
// constexpr year_weeknum_weekday(const year_lastweek_weekday& ylwwd) noexcept;
// constexpr year_weeknum_weekday(const day_point& dp) noexcept;
// constexpr year_weeknum_weekday(const sys_days& dp) noexcept;
//
// year_weeknum_weekday& operator+=(const years& y) noexcept;
// year_weeknum_weekday& operator-=(const years& y) noexcept;
@@ -37,7 +37,7 @@
// constexpr iso_week::weeknum weeknum() const noexcept;
// constexpr iso_week::weekday weekday() const noexcept;
//
// constexpr operator day_point() const noexcept;
// constexpr operator sys_days() const noexcept;
// constexpr bool ok() const noexcept;
// };
//
@@ -79,13 +79,13 @@ static_assert( std::is_nothrow_constructible<iso_week::year_weeknum_weekday,
static_assert( std::is_convertible<iso_week::year_lastweek_weekday,
iso_week::year_weeknum_weekday>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::year_weeknum_weekday,
iso_week::day_point>{}, "");
static_assert( std::is_convertible<iso_week::day_point,
iso_week::sys_days>{}, "");
static_assert( std::is_convertible<iso_week::sys_days,
iso_week::year_weeknum_weekday>{}, "");
static_assert( std::is_nothrow_constructible<iso_week::day_point,
static_assert( std::is_nothrow_constructible<iso_week::sys_days,
iso_week::year_weeknum_weekday>{}, "");
static_assert( std::is_convertible<iso_week::year_weeknum_weekday,
iso_week::day_point>{}, "");
iso_week::sys_days>{}, "");
int
main()
@@ -102,7 +102,7 @@ main()
static_assert(x1.weeknum() == 53_w, "");
static_assert(x1.weekday() == tue, "");
constexpr year_weeknum_weekday x2 = day_point{days{16792}};
constexpr year_weeknum_weekday x2 = sys_days{days{16792}};
static_assert(x2.year() == 2015_y, "");
static_assert(x2.weeknum() == 52_w, "");
static_assert(x2.weekday() == wed, "");
@@ -118,8 +118,8 @@ main()
assert(x3.weeknum() == 52_w);
assert(x3.weekday() == wed);
constexpr day_point dp = 2015_y/52_w/wed;
static_assert(dp == day_point{days{16792}}, "");
constexpr sys_days dp = 2015_y/52_w/wed;
static_assert(dp == sys_days{days{16792}}, "");
static_assert(x0.ok(), "");
static_assert(x1.ok(), "");