C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: [forward_list] push_front is allowed to invalidate iterators and/or references?
From: Tadeus Prastowo (tadeus.prastowo_at_[hidden])
Date: 2019-06-26 16:35:21


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,
Tadeus

STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups