878. forward_list preconditions

Section: 26.3.9 [forwardlist] Status: C++11 Submitter: Martin Sebor Opened: 2008-08-23 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [forwardlist].

View all issues with C++11 status.

Discussion:

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, 26.3.9.6 [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(). ...