C++ Logo

std-proposals

Advanced search

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

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Sun, 31 Mar 2024 16:27:17 +0000
> 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.

I wasn't stating how you can do it in practice, but how it actually works, I have seen code that looks like this. You can do this right-now, just not in a cross-platform way that is supported by the standard. Yeah, Linux needs to catchup on this. But library implementers aren't constrained to implementing things with the tools that the standard defines to them.

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/expand?view=msvc-170

Received on 2024-03-31 16:27:22