Title
Is [iterator.requirements.general]/9 too broadly applied?
Status
resolved
Section
[iterator.requirements.general]
Submitter
Marshall Clow

Created on 2014-03-25.00:00:00 last changed 41 months ago

Messages

Date: 2021-06-23.00:00:00

[ 2021-06-23 Resolved by adoption of P0896R4 in San Diego. Status changed: New → Resolved. ]

Date: 2014-05-15.00:00:00

[ 2014-05-22, Daniel comments ]

Given that forward iterators (and beyond) are refinements of input iterator, moving this constraint to input iterators won't help much because it would still hold for all refined forms.

Date: 2014-03-25.00:00:00

[iterator.requirements.general] p9 says:

Destruction of an iterator may invalidate pointers and references previously obtained from that iterator.

But the resolution of LWG issue 2360 specifically advocates returning *--temp; where temp is a local variable.

And [forward.iterators] p6 says:

If a and b are both dereferenceable, then a == b if and only if *a and *b are bound to the same object.

which disallows "stashing" iterators (i.e, iterators that refer to data inside themselves).

So, I suspect that the restriction in p9 should only apply to input iterators, and can probably be moved into [input.iterators] instead of [iterator.requirements.general].

History
Date User Action Args
2021-06-23 13:24:25adminsetmessages: + msg11950
2021-06-23 13:24:25adminsetstatus: new -> resolved
2014-05-22 20:29:42adminsetmessages: + msg6965
2014-03-25 00:00:00admincreate