C++ Logo

std-proposals

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 22 Jan 2025 18:23:05 +0200
On Wed, 22 Jan 2025 at 18:16, Gia Phan via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi all,
>
> I'm Rylex Phan, really new to this community, please correct me if I'm wrong!
>
> I was wondering what we can do to moved STL containers. I was searching for an answer and stumbled across this Stackoverflow answer by Howard Hinnant.
>
> I was surprised to see that there was nothing in the standard that specified what operation can be performed after a move.

Sure there is, and it's mentioned in Howard's answer: "you can perform
any operation on the object which has no preconditions".

> For example, assignment and destruction are obvious, but what about something like resize(), reserve()? Shouldn't we have some clearly defined behavior?

We do.

Received on 2025-01-22 16:23:19