This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
3291.iota_view::iterator
has the wrong iterator_category
Section: 25.6.4.3 [range.iota.iterator] Status: C++20 Submitter: Eric Niebler Opened: 2019-09-13 Last modified: 2021-02-25
Priority: 0
View other active issues in [range.iota.iterator].
View all other issues in [range.iota.iterator].
View all issues with C++20 status.
Discussion:
In the old way of looking at the world, forward iterators need to return real references. Since dereferencing iota_view
's iterators returns by value, it cannot be a C++17 forward iterator. (It can, however, be a C++20 forward_iterator
.) However, iota_view
's iterator has an iterator_category
that (sometimes) falsely claims that it is forward or better (depending on the properties of the weakly_incrementable
type it wraps).
[2019-10-19 Issue Prioritization]
Status to Tentatively Ready and priority to 0 after eight positive votes on the reflector.
Proposed resolution:
This wording is relative to N4830.
Modify 25.6.4.3 [range.iota.iterator] as indicated:
namespace std::ranges { template<class W, class Bound> struct iota_view<W, Bound>::iterator { private: […] public: using iterator_conceptategory = see below; using iterator_category = input_iterator_tag; using value_type = W; using difference_type = IOTA-DIFF-T(W); […] }; […] }-1-
iterator::iterator_c oncept ategory
is defined as follows:
(1.1) — If
W
modelsadvanceable
, theniterator_c oncept ategory
israndom_access_iterator_tag
.(1.2) — Otherwise, if
W
modelsdecrementable
, theniterator_c oncept ategory
isbidirectional_iterator_tag
.(1.3) — Otherwise, if
W
modelsincrementable
, theniterator_c oncept ategory
isforward_iterator_tag
.(1.4) — Otherwise,
iterator_c oncept ategory
isinput_iterator_tag
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4