Title
vector<bool> iterators are not random access
Status
open
Section
[vector.bool]
Submitter
BSI

Created on 2010-08-25.00:00:00 last changed 90 months ago

Messages

Date: 2017-06-05.15:41:21

Rationale:

No consensus to make this change at this time.

Date: 2017-06-02.00:00:00

[ 2017-06-02 Issues Telecon ]

P0022 is exploring a resolution. We consider this to be fairly important issue

Move to Open, set priority to 3

Date: 2017-06-05.15:41:21

[ 2017-02 in Kona, LEWG recommends NAD ]

D0022 Proxy Iterators for the Ranges Extensions - as much a fix as we’re going to get for vector<bool>.

Date: 2011-03-05.21:44:45

[ 2010-11 Batavia: ]

Closed as NAD Future, because the current iterator categories cannot correctly describe vector<bool>::iterator. But saying that they are Random Access Iterators is also incorrect, because it is not too hard to create a corresponding test that fails. We should deal with the more general proxy iterator problem in the future, and see no benefit to take a partial workaround specific to vector<bool> now.

Date: 2011-03-05.21:44:45

[ Old Proposed Resolution: ]

Insert a new paragraph into [vector.bool] between p4 and p5:

[Note All functions in the library that take a pair of iterators to denote a range shall treat vector<bool> iterators as-if they were random access iterators, even though the reference type is not a true reference.-- end note]

Date: 2011-03-05.21:44:45

[ Post-Rapperswil Alisdair provides wording ]

Initial wording is supplied, deliberately using Note in preference to Remark although the author notes his preference for Remark. The issue of whether iterator_traits<vector<bool>>::iterator_category is permitted to report random_access_iterator_tag or must report input_iterator_tag is not addressed.

Date: 2011-03-05.21:44:45

[ Rapperswil Review ]

The consensus at Rapperswil is that it is too late for full support for proxy iterators, but requiring the library to respect vector<bool> iterators as-if they were random access would be preferable to flagging this container as deliberately incompatible with standard library algorithms.

Alisdair to write the note, which may become normative Remark depending on the preferences of the project editor.

Date: 2011-03-05.21:44:45

[ Resolution proposed in ballot comment ]

Either revise the iterator requirements to support proxy iterators (restoring functionality that was lost when the Concept facility was removed) or add an extra paragraph to the vector<bool> specification requiring the library to treat vector<bool> iterators as-if they were random access iterators, despite having the wrong reference type.

Date: 2010-10-24.03:04:13

Addresses GB-118

vector<bool> iterators are not random access iterators because their reference type is a special class, and not bool &. All standard libary operations taking iterators should treat this iterator as if it was a random access iterator, rather than a simple input iterator.

History
Date User Action Args
2017-06-05 15:41:21adminsetmessages: + msg9215
2017-06-05 15:41:21adminsetmessages: + msg9214
2017-06-05 15:41:21adminsetstatus: lewg -> open
2014-11-24 15:11:58adminsetstatus: nad future -> lewg
2011-03-05 21:44:45adminsetmessages: + msg5612
2011-03-05 21:44:45adminsetmessages: + msg5611
2011-03-05 21:44:45adminsetmessages: + msg5610
2011-03-05 21:44:45adminsetmessages: + msg5609
2011-03-05 21:44:45adminsetmessages: + msg5608
2011-03-05 21:44:45adminsetmessages: + msg5607
2011-03-05 21:44:45adminsetstatus: open -> nad future
2010-10-24 03:04:13adminsetmessages: + msg4919
2010-08-25 00:00:00admincreate