C++ Logo

std-proposals

Advanced search

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

From: Mateusz Pusz <mateusz.pusz_at_[hidden]>
Date: Tue, 18 Jun 2024 17:38:07 +0200
Multiply syntax will always create a quantity. So if I write:

auto q = 4 * deg_C;

I will end up with a delta temperature equal to 4 K.

quantity q = 4 * deg_C; // the same thing as above

If I try:

quantity_point qp = 4 * deg_C;

I will get a compile-time error as a quantity_point is not implicitly
constructible from the quantity.

To create a quantity_point, I have to do one of the following:

quantity_point qp1 = zeroth_degree_Celsius + 4 * deg_C;
quantity_point qp2(4 * deg_C, zeroth_degree_Celsius);
quantity_point qp3(4 * deg_C); // proper point origin provided by default

All of the above will create a temperature point with a value equal
to 277.15 K.

wt., 18 cze 2024 o 17:31 Gašper Ažman via Std-Proposals <
std-proposals_at_[hidden]> napisał(a):

> it's 28 delta-K.
>
> On Tue, Jun 18, 2024 at 4:30 PM Ville Voutilainen via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > On Tue, 18 Jun 2024 at 15:28, Tiago Freire via Std-Proposals
> > <std-proposals_at_[hidden]> wrote:
> > > quantity Temperature = (28.0 * deg_C).in(K);
> >
> > Okay people, let's backtrack a bit. Is that temperature 28K?
> > --
> > Std-Proposals mailing list
> > Std-Proposals_at_[hidden]
> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-06-18 15:38:21