This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofResolved status.
time_point constructors need to beconstexprSection: 30.6[time.point]Status:ResolvedSubmitter: Anthony WilliamsOpened: 2011-05-13Last modified: 2016-01-28
Priority:Not Prioritized
View all issues withResolved status.
Discussion:
In 30.6[time.point],time_point::min() andtime_point::max() are listed asconstexpr. However,time_point has noconstexpr constructors, so is not a literal type, and so these functions cannot beconstexpr without adding aconstexpr constructor for implementation purposes.
constexpr to the constructors oftime_point. The effects ofthe constructor template basically imply that the member functiontime_since_epoch() isintended to beconstexpr as well.[2012, Portland]
Resolved by adopting papern3469.
Proposed resolution:
This wording is relative to the FDIS.
Alter the class template definition in 30.6[time.point] as follows:
template <class Clock, class Duration = typename Clock::duration>class time_point { […]public:// 20.11.6.1, construct:constexpr time_point();// has value epochconstexpr explicit time_point(const duration& d);// same as time_point() + d template <class Duration2>constexpr time_point(const time_point<clock, Duration2>& t);// 20.11.6.2, observer:constexpr duration time_since_epoch() const; […]};Alter the declarations in 30.6.2[time.point.cons]:
constexpr time_point();-1-Effects: Constructs an object of type
time_point, initializingd_withduration::zero(). Such atime_pointobject represents the epoch.
constexpr explicit time_point(const duration& d);-2-Effects: Constructs an object of type
time_point, initializingd_withd. Such atime_pointobject represents the epoch+ d.
template <class Duration2>constexpr time_point(const time_point<clock, Duration2>& t);-3-Remarks: This constructor shall not participate in overload resolution unless
-4-Effects: Constructs an object of typeDuration2is implicitlyconvertible toduration.time_point, initializingd_witht.time_since_epoch().
Alter the declaration in 30.6.3[time.point.observer]:
constexpr duration time_since_epoch() const;-1-Returns: d_.