[sequence.reqmts], [associative.reqmts.general]: Grammatical corrections for a.erase(q)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- cpp
- Ambito
- documentation
Direzione di ricerca
Inizia con le clausole [sequence.reqmts] e [associative.reqmts.general] nella bozza della sorgente. Applica le modifiche alla formulazione della resolution sia alle occorrenze di a.erase(q) sia alla formulazione analoga di a.erase(r), quindi verifica che ogni descrizione del valore restituito riporti “If no element follows” e corrisponda al testo proposto nell’issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Discussion:
The existing wording for a.erase(q) caught me out because it was ambiguous without referring back through the standard to prior knowledge. It also caught out others I mentioned it to. The ambiguity is due to grammatical incorrectness.
Current wording is:
Returns: An iterator that points to the element immediately following q prior to the element being
erased. If no such element exists, a.end() is returned.
The key ambiguity is in the phrase "If no such element exists", which depending on your reading, may either refer to "the element immediately following q", or
to "the element being erased". Grammatically, because the latter is closer to the secondary sentence, the logical conclusion when taking the paragraph in isolation that that is the 'element' referred to. This is apparently not the case.
The semantics of the two interpretations are as follows:
"the element immediately following q" - if no element exists after the element being erased, return end().
"the element being erased" - if erase has been supplied an iterator which does not point to an element in *this, return end().
The correct interpretation relies on knowledge of the blanket wording in [sequence.reqmts] 2.11, which states that q must be a valid constant interator into a. However, most people reading the standard for the first, second or even third time may not make that backwards leap to establish that the grammatical structure of the sentence is predicated on a sentence in an earlier passage.
Making this grammatically-correct is easily achievable by changing the phrase to "If no element follows q".
The similar wording for sequence.reqmts a.erase(q1, q2) is unambiguous because there is 'elements' and 'element', making it clear what 'element' in the second sentence refers to.
However, the same wording occurs later in the standard under [associative.reqmts.general].
Resolution:
This wording is relative to N5036.
- Modify [sequence.reqmts] as indicated:
a.erase(q)
-45- Result: iterator.
-46- Preconditions: For vector, inplace_vector, and deque, T is Cpp17MoveAssignable.
-47- Effects: Erases the element pointed to by q.
-48- Returns: An iterator that points to the element immediately following q prior to the element being
erased. If no element follows q, a.end() is returned.
- Modify [associative.reqmts.general] as indicated:
a.erase(q)
-126- Result: iterator
-127- Effects: Erases the element pointed to by q.
-128- Returns: An iterator pointing to the element immediately following q prior to the element being erased.
If no element follows q, returns a.end().
a.erase(r)
-130- Result: iterator
-131- Effects: Erases the element pointed to by r.
-132- Returns: An iterator pointing to the element immediately following r prior to the element being erased.
If no element follows r, returns a.end().
- Lingua principale
- TeX
- Stelle
- 227
- Fork
- 815
- Merge medio
- 17h 21m
- PR unite (30g)
- 30
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cplusplus/draft
-
"potentially throwing" v.s. "potentially-throwing"Forse già presa @frederick-vs-ja l’ha presa 7 giorni fa. Apertadecision-required
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
cplusplus/draft#9350 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
P2-Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
cplusplus/draft#9349 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
P2-Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
cplusplus/draft#9348 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[dcl.array] Grammar typoApertaP2-Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
cplusplus/draft#9343 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cplusplus/draft#9342 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cplusplus/draft
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
alphagov/govuk-frontend-docs#668 ·
I maintainer di solito rispondono entro 2 giorni
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
lesson-submission needs-ac pending-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
Ikalus1988/MisakaNet#2868 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
bancolombia/scaffold-clean-architecture#1001 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
navikt/esyfo-narmesteleder#615 ·
I maintainer di solito rispondono entro 1 giorno