Open maxbla opened 3 years ago
After some investigation, most TimeSpan
constructors can be made constexpr, but most DateTime
constructors can't without C++14 constexpr features (Arduino currently uses C++11 by default).
If Arduino ever makes C++14 the default, This stack overflow question has some code that might be worth borrowing from.
Arduino board: All; N/a
Arduino IDE version (found in Arduino -> About Arduino menu): N/a
Feature Request:
constexpr
constructors forDateTime
/TimeSpan
This would allow me to generate helpful error messages at compile time for
DateTimes
/TimeSpans
that are invalid in a certain context usingstatic_assert
. Previously I have used run-time checks with Serial.println, but this method only catches mistakes if developers are looking at their serial console.I think this is as simple as marking the constructors
constexpr
, but I might be missing something