Closed wg21bot closed 4 years ago
We have existing equivalent expressions to the above:
1815y/December/10d
1815y/12/10
The lack of a user-defined-literal for month
is consistent with weekday
which also lacks a user-defined-literal. Instead, both of these types have inlined constexpr constants which name each valid value.
It was a conscious design decision that types with named constants did not additionally need user-defined-literals. It would be a needless expansion of the API, which has non-zero costs in documenting, learning and teaching.
LEWG in Belfast: Rejected. No consensus for change.
std::chrono::month is the only duration-like type without a UDL, which makes constructing objects such as this look a little off. chrono::year_month_day{1815y, chrono::month{12}, 10d}}
Proposed change: Add operator""month, which behaves similarly to operator""y. The earlier expression could then read as: chrono::year_month_day{1815y, 12month, 10d}}