Date
2020-02-25.00:00:00
Message id
11150

Content

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.