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

481. unique's effects on the range [result, last)

Section: 27.7.9 [alg.unique] Status: NAD Submitter: Andrew Koenig Opened: 2004-08-30 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [alg.unique].

View all issues with NAD status.

Discussion:

The standard says that unique(first, last) "eliminates all but the first element from every consecutive group of equal elements" in [first, last) and returns "the end of the resulting range". So a postcondition is that [first, result) is the same as the old [first, last) except that duplicates have been eliminated.

What postconditions are there on the range [result, last)? One might argue that the standard says nothing about those values, so they can be anything. One might also argue that the standard doesn't permit those values to be changed, so they must not be. Should the standard say something explicit one way or the other?

Proposed resolution:

Rationale:

We don't want to make many guarantees about what's in [result, end). Maybe we aren't being quite explicit enough about not being explicit, but it's hard to think that's a major problem.