C++ Logo


Advanced search

Re: [forward_list] push_front is allowed to invalidate iterators and/or references?

From: Tadeus Prastowo <tadeus.prastowo_at_[hidden]>
Date: Wed, 26 Jun 2019 23:35:21 +0200
On Wed, Jun 26, 2019 at 11:00 PM Brian Bi <bbi5291_at_[hidden]> wrote:
> http://eel.is/c++draft/container.requirements.general#12
>> Unless otherwise specified (either explicitly or by defining a function in terms of other functions), invoking a container member function or passing a container as an argument to a library function shall not invalidate iterators to, or change the values of, objects within that container.

Thank you very much for pointing that out. Any idea why that passage
mentions only the word "iterator" but not "reference"?

> I suppose that the first sentence of [sequence.forwardlist.modifiers]/1 is redundant.

Yes, unless the words "reference" and "iterator" imply different things.

Best regards,

Received on 2019-06-26 16:37:16