Created on 2020-02-09.00:00:00 last changed 49 months ago
[ 2020-11-09 Status changed: Tentatively NAD → NAD. ]
[ 2020-02-13, Prague ]
LWG decided for NAD: The ranges::basic_istream_view::iterator is a move-only type and thus cannot meet the Cpp17 requirements (even output_iterator_tag), as such it should not specialize iterator_traits, to avoid misleading results when it is passed to new algorithms.
A related issue, LWG 3397, is supposed to take care for a problem with the definition of the iterator_category member type of this template.[ 2020-02 Prioritized as P2 Monday morning in Prague ]
Previous resolution [SUPERSEDED]:This wording is relative to N4849.
Modify [range.istream.iterator], class template basic_istream_view::iterator synopsis, as indicated:
namespace std::ranges { template<class Val, class CharT, class Traits> class basic_istream_view<Val, CharT, Traits>::iterator { // exposition only public: using iterator_category = input_iterator_tag; using difference_type = ptrdiff_t; using value_type = Val; using reference = Val&; iterator() = default; […] }; }
Every instantiation of ranges::basic_istream_view::iterator has an empty iterator_traits, i.e. the type
iterator_traits<ranges::basic_istream_view<Val, CharT, Traits>::iterator>
has no members.
This happens because basic_istream_view::iterator neither models cpp17-iterator (since this concept requires copyability, which this iterator is by design not) nor does it define all four of the member types difference_type, value_type, reference, and iterator_category (it is missing reference). Therefore by [iterator.traits] p3, this iterator's specialization of iterator_traits will be empty if generated from the iterator_traits primary template. Since basic_istream_view::iterator is indeed an iterator, its iterator_traits should certainly not be empty. The simplest solution here is to define the member type reference in the definition of basic_istream_view::iterator, which will enable its iterator_traits specialization to be appropriately populated from the primary template.History | |||
---|---|---|---|
Date | User | Action | Args |
2020-11-09 20:22:58 | admin | set | messages: + msg11536 |
2020-02-14 12:39:17 | admin | set | status: new -> nad |
2020-02-10 19:13:13 | admin | set | messages: + msg11028 |
2020-02-10 06:02:51 | admin | set | messages: + msg11007 |
2020-02-09 20:05:49 | admin | set | messages: + msg11006 |
2020-02-09 00:00:00 | admin | create |