cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

GB342 27.08.4.3 Add user-defined-literal "month" #338

Closed wg21bot closed 4 years ago

wg21bot commented 4 years ago

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}}

HowardHinnant commented 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.

tituswinters commented 4 years ago

LEWG in Belfast: Rejected. No consensus for change.