This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

878. forward_list preconditions

Section: 24.3.9 [forward.list] Status: C++11 Submitter: Martin Sebor Opened: 2008-08-23 Last modified: 2023-02-07

Priority: Not Prioritized

View all other issues in [forward.list].

View all issues with C++11 status.


forward_list member functions that take a forward_list::iterator (denoted position in the function signatures) argument have the following precondition:

Requires: position is dereferenceable or equal to before_begin().

I believe what's actually intended is this:

Requires: position is in the range [before_begin(), end()).

That is, when it's dereferenceable, position must point into *this, not just any forward_list object.

[ San Francisco: ]

Robert suggested alternate proposed wording which had large support.

[ Post Summit: ]

Walter: "position is before_begin() or a dereferenceable": add "is" after the "or"

With that minor update, Recommend Tentatively Ready.

Proposed resolution:

Change the Requires clauses [forwardlist], p21, p24, p26, p29, and, [forwardlist.ops], p39, p43, p47 as follows:

Requires: position is before_begin() or is a dereferenceable iterator in the range [begin(), end()) or equal to before_begin(). ...