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.

869. Bucket (local) iterators and iterating past end

Section: 23.2.8 [unord.req] Status: C++11 Submitter: Sohail Somani Opened: 2008-07-22 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [unord.req].

View all other issues in [unord.req].

View all issues with C++11 status.

Discussion:

Is there any language in the current draft specifying the behaviour of the following snippet?

unordered_set<int> s;
unordered_set<int>::local_iterator it = s.end(0);

// Iterate past end - the unspecified part
it++;

I don't think there is anything about s.end(n) being considered an iterator for the past-the-end value though (I think) it should be.

[ San Francisco: ]

We believe that this is not a substantive change, but the proposed change to the wording is clearer than what we have now.

[ Post Summit: ]

Recommend Tentatively Ready.

Proposed resolution:

Change Table 97 "Unordered associative container requirements" in 23.2.8 [unord.req]:

Table 97: Unordered associative container requirements
expressionreturn typeassertion/note pre/post-conditioncomplexity
b.begin(n) local_iterator
const_local_iterator for const b.
Pre: n shall be in the range [0,b.bucket_count()). Note: [b.begin(n), b.end(n)) is a valid range containing all of the elements in the nth bucket. b.begin(n) returns an iterator referring to the first element in the bucket. If the bucket is empty, then b.begin(n) == b.end(n). Constant
b.end(n) local_iterator
const_local_iterator for const b.
Pre: n shall be in the range [0, b.bucket_count()). b.end(n) returns an iterator which is the past-the-end value for the bucket. Constant