All constructors except the copy constructor of std::chrono::duration are defined as constexpr. Why the copy constructor can't be defined as constexpr as well?
Asked
Active
Viewed 133 times
1 Answers
3
Whether it can be constexpr
or not depends on some internal details. From the language standard:
The defaulted copy constructor of duration shall be a constexpr function if and only if the required initialization of the member rep_ for copy and move, respectively, would satisfy the requirements for a constexpr function.
So it will be constexpr
if the internal representation of the class will allow it.

1201ProgramAlarm
- 32,384
- 7
- 42
- 56