C++ Logo

std-proposals

Advanced search

Re: [std-proposals] On the standardization of mp-units P3045R1

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 19 Jun 2024 14:10:55 +0300
On Wed, 19 Jun 2024 at 13:13, Mateusz Pusz <mateusz.pusz_at_[hidden]> wrote:
>
> Oh, now I start to understand what you meant. Thanks!
>
> We could definitely provide pairs of UDLs just for Celsius and Fahrenheit:
> - 4abs_deg_C - quantity_point
> - 4abs_deg_C - quantity_point
> - 4rel_deg_F - quantity
> - 4rel_deg_F - quantity
>
> and maybe also disable the multiply syntax for those. This should increase the chances of coding things correctly. However, as Sebastian mentioned, the user who is not aware of quantity_points or those UDLs would still be able to make it wrong.

There's always the possibility of getting it wrong, and writing code
that ends up being relatively unreadable. But with such UDLs
as you depict above, we can have documented good-code examples that
are quite readable and not error-prone.

Received on 2024-06-19 11:11:09