Hi,
stringstream::str() changed ref-qualification (and gained a && overload) in C++20. How was that sorted out regarding ABI issues? Is the ABI issue serious?
Cheers,
Lénárd
From: "Gašper Ažman via Std-Proposals" <std-proposals@lists.isocpp.org>
Sent: July 29, 2021 12:56:54 PM GMT+01:00
To: Std-Proposals <std-proposals@lists.isocpp.org>
Cc: "Gašper Ažman" <gasper.azman@gmail.com>
Subject: Re: [std-proposals] lvalue ref-qualified this-pointers in the standard library
The short answer is that it's an ABI break. I also ref-qualify assignment operators.
actually what you propose was in the motivation of the paper introducing ref-qualification of member functions.
I started to teach to lvalue-ref qualify user-declared assignment operators.
but changing the standard library and the language might be too much of a change with not too much of a benefit that it would be worthwhile attempting. (I have thought proposing it)
Regards
Peter
sent from a mobile device so please excuse strange words due to autocorrection.
Peter Sommerlad
peter.cpp@sommerlad.ch
+41-79-432 23 32
> On 28 Jul 2021, at 18:34, Paul Raffer via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
>
>
> Another proposal idea:
>
>
> I think in most setters (and other methods that modify an object like operator=) in the standard library (e.g. the setters real and imag in the complex class) the this-pointer should be lvalue ref-qualified, so that temporary objects can't be modyfied.
>
> The signature of real should look like this
> constexpr void real(T value) &;
> instead of this
> constexpr void real(T value);
>
>
> In C++20 code like this
> std::complex<double>{}.real(42.0);
> or this
> std::complex<double>{} = std::complex<double>{};
> would compile, but makes no sense.
>
>
> That could potentially break existing code, but only code that has bugs anyway. So that's a feature not a bug. Or am I wrong?
>
>
> Paul
>
> --
> Std-Proposals mailing list
> Std-Proposals@lists.isocpp.org
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals