Add to_duration() to time_of_day:

* This is a synonym for static_cast<precision>(*this).
* This variation can be easier to spell when the precision
  is not conveniently available.
This commit is contained in:
Howard Hinnant 2015-08-08 13:38:12 -04:00
parent 33f923b508
commit 2d115a8022

20
date.h
View File

@ -3096,6 +3096,11 @@ public:
return to24hr();
}
CONSTCD14 precision to_duration() const noexcept
{
return static_cast<precision>(*this);
}
CONSTCD14 time_of_day_storage& make24() noexcept {base::make24(); return *this;}
CONSTCD14 time_of_day_storage& make12() noexcept {base::make12(); return *this;}
@ -3157,6 +3162,11 @@ public:
return to24hr() + m_;
}
CONSTCD14 precision to_duration() const noexcept
{
return static_cast<precision>(*this);
}
CONSTCD14 time_of_day_storage& make24() noexcept {base::make24(); return *this;}
CONSTCD14 time_of_day_storage& make12() noexcept {base::make12(); return *this;}
@ -3223,6 +3233,11 @@ public:
return to24hr() + m_ + s_;
}
CONSTCD14 precision to_duration() const noexcept
{
return static_cast<precision>(*this);
}
CONSTCD14 time_of_day_storage& make24() noexcept {base::make24(); return *this;}
CONSTCD14 time_of_day_storage& make12() noexcept {base::make12(); return *this;}
@ -3298,6 +3313,11 @@ public:
return to24hr() + m_ + s_ + sub_s_;
}
CONSTCD14 precision to_duration() const noexcept
{
return static_cast<precision>(*this);
}
CONSTCD14 time_of_day_storage& make24() noexcept {base::make24(); return *this;}
CONSTCD14 time_of_day_storage& make12() noexcept {base::make12(); return *this;}