C++ Logo

std-proposals

Advanced search

Re: [std-proposals] When does vector::push_back() invalidation happen?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 31 Mar 2024 09:13:34 -0700
On Sunday, 31 March 2024 09:09:43 PDT Tiago Freire via Std-Proposals wrote:
> 1. It can expand the underlying buffer. In which case contents aren’t
> moved and no references are invalidated in practice.

That's really hard to do. We've been asking for a "realloc_no_move" or
something equivalent for 15 years. That is, resize the underlying buffer if
possible, but don't move the data if not.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Principal Engineer - Intel DCAI Cloud Engineering

Received on 2024-03-31 16:13:36