C++ Logo

std-proposals

Advanced search

Re: [std-proposals] vector::push_back must not invalidate past-the-end iterator

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 8 Dec 2025 18:52:49 +0000
On Mon, 8 Dec 2025 at 18:42, Nikl Kelbon via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> About this:
>
> > There is no other container where getting an end iterator and
> inserting an element into the end of the container would *ever* leave
> that end iterator to be pointing to something valid. Not `list`, not
> `deque`
>
> https://godbolt.org/z/ndePjE9c6
>
> It works for deque. Its possible
>

It's UB for deque as well though:
https://godbolt.org/z/6a7zo5Y5E

Received on 2025-12-08 18:53:11