Date: Wed, 22 Jan 2025 18:34:12 +0200
On Wed, 22 Jan 2025 at 18:30, Ivan Matek <libbooze_at_[hidden]> wrote:
>
>
>
> On Wed, Jan 22, 2025 at 5:23 PM Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> On Wed, 22 Jan 2025 at 18:16, Gia Phan via Std-Proposals
>>
>>
>> > For example, assignment and destruction are obvious, but what about something like resize(), reserve()? Shouldn't we have some clearly defined behavior?
>>
>> We do.
>
>
> I guess this depends on what you mean by "clearly defined". I believe result of this program is not clearly defined as in we know what it will output:
> int main()
> {
> std::string s{"abc"};
> auto s2 = std::move(s);
> s.resize(5,'x');
> std::print("{}",s);
> }
> (and that is intentional, since in theory because of SSO it is faster to leave source of move unmodified, although no implementation does that).
Sure. It's less clearly defined for std::string than it is for std::vector.
>
>
>
> On Wed, Jan 22, 2025 at 5:23 PM Ville Voutilainen via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> On Wed, 22 Jan 2025 at 18:16, Gia Phan via Std-Proposals
>>
>>
>> > For example, assignment and destruction are obvious, but what about something like resize(), reserve()? Shouldn't we have some clearly defined behavior?
>>
>> We do.
>
>
> I guess this depends on what you mean by "clearly defined". I believe result of this program is not clearly defined as in we know what it will output:
> int main()
> {
> std::string s{"abc"};
> auto s2 = std::move(s);
> s.resize(5,'x');
> std::print("{}",s);
> }
> (and that is intentional, since in theory because of SSO it is faster to leave source of move unmodified, although no implementation does that).
Sure. It's less clearly defined for std::string than it is for std::vector.
Received on 2025-01-22 16:34:25