Title
LWG 3291 reveals deficiencies in counted_iterator
Status
resolved
Section
[counted.iterator]
Submitter
Patrick Palka

Created on 2020-02-25.00:00:00 last changed 43 months ago

Messages

Date: 2021-05-18.00:00:00

[ 2021-05-18 Resolved by the adoption of P2259R1 at the February 2021 plenary. Status changed: New → Resolved. ]

Date: 2020-03-29.00:00:00

[ 2020-03-29 Issue Prioritization ]

Priority to 2 after reflector discussion.

Date: 2020-02-25.00:00:00

LWG 3291 makes changes to iota_view so that it no longer falsely claims it's a C++17 forward iterator. A side effect of this change is that the counted_iterator of an iota_view can no longer model forward_iterator, no matter what the properties of the underlying weakly_incrementable type are. For example, the following snippet is ill-formed after LWG 3291:

auto v = views::iota(0);
auto i = counted_iterator{v.begin(), 5};
static_assert(random_access_iterator<decltype(i)>); // fails after LWG 3291

The problem seems to be that counted_iterator populates its iterator_traits but it does not specify its iterator_concept, so we fall back to looking at its iterator_category to determine its C++20 iterator-ness. It seems counted_iterator should specify its iterator_concept appropriately based on the iterator_concept of the iterator it wraps.

History
Date User Action Args
2021-05-18 09:43:39adminsetmessages: + msg11813
2021-05-18 09:43:39adminsetstatus: new -> resolved
2020-03-29 15:35:56adminsetmessages: + msg11176
2020-02-25 00:00:00admincreate