New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[forwardlist.ops] bogus specification of forward_list::unique LWG2997 #4221
Comments
Similar jumbled words appear in other places: [alg.unique]p1:
[list.ops]p20:
The |
@jwakely I think we can handle this editorially, but let me know if you'd prefer LWG to take this. |
I'm happy for it to be treated editorially. There's no disagreement about what the expected semantics are, and no implementation divergence, so it's just a case of using words that aren't bad. |
@zygoloid : The proposed change to [alg.unique] seems incorrect. The term "erases" is certainly undefined in the context of an algorithm; we don't have a reference to the enclosing container where we could "erase". |
This overlaps https://cplusplus.github.io/LWG/issue2997 but that issue's PR doesn't fix the issue @zygoloid pointed out. That PR has a normative component though (the requirement that the predicate is an equivalence relation). I'll redraft. |
Is "consecutive group of equal elements" wrong as well? It is the equal elements which are consecutive, not the groups. Arguably, given Would "from each group of consecutive equal elements" be better? |
The specification for
forward_list::unique
says:Err, what?
Given
{1, 1, 1, 1, 1, 2, 2, 2, 2, 2}
, we:[first + 1, last)
:{1, 1, 1, 1, 2, 2, 2, 2, 2}
.*i == *(i-1)
, dropping the first2
.{1, 1, 1, 1}
and{2, 2, 2, 2}
.The result is
{1, 1, 2, 2}
. That doesn't seem right.The problem here is that we express basically every part of the rules twice or three times in the same sentence, and usually at least all but one of those repetitions is wrong. (Eg, compare "equal" to the more careful description later, compare "all but the first" with the use of
[first + 1, last)
and*i == *(i-1)
.)Perhaps we meant:
Oh, and while we're here: what are
first
andlast
supposed to be here? I think it meansbegin()
andend()
...The text was updated successfully, but these errors were encountered: