C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Defined STL containers moved-from state

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Wed, 22 Jan 2025 13:11:15 -0500
On Wed, 22 Jan 2025, 13:03 Gia Phan via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> Ohhh, so it's basically UB for:
> - Anything that requires reading any member or content of the moved
> containers,
> - Modifications like append, push(_back) to it without resetting all of
> its member/content to a deterministic state (assigning new value,
> reconstructing)
>

No. push_back has no preconditions. You can always call it, and it will
have n+1 members, but the value of n is not specified by the standard.

It's not undefined though.



> I'll keep these in mind. I was just confused because it's not mentioned
> anywhere. Thank you!
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-01-22 18:12:38