C++ Logo

std-proposals

Advanced search

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

From: Mateusz Pusz <mateusz.pusz_at_[hidden]>
Date: Wed, 19 Jun 2024 13:42:24 +0200
Agree.

I think that we should also add `abs_K` and `rel_K` because:

quantity q = (300 * K).in(deg_C);

may also be misunderstood by novices. This, however, means that we
also need to provide all prefixed versions of those (e.g. `abs_nK`,
`rel_kK`, etc).

śr., 19 cze 2024 o 13:11 Ville Voutilainen <ville.voutilainen_at_[hidden]>
napisał(a):

> 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:42:37