Date: Wed, 22 Jan 2025 17:30:39 +0100
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).
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).
Received on 2025-01-22 16:30:51