-
Notifications
You must be signed in to change notification settings - Fork 781
Closed
Description
The begin
/end
of basic_istream_view
is defined in [range.istream.view]
template<movable Val, class CharT, class Traits = char_traits<CharT>>
class basic_istream_view : public view_interface<basic_istream_view<Val, CharT, Traits>> {
public:
constexpr auto begin() {
*stream_ >> value_;
return iterator{*this};
}
constexpr default_sentinel_t end() const noexcept;
};
Even if begin()
is non-const
-qualified, since end()
simply returns default_sentinel
, it is still designed to be const
-qualified member function, which allows us to call as_const(r).end()
even if as_const(r)
is not a range
.
However, the begin
/end
of chunk_view
for input ranges is defined in [range.chunk.view.input] as
template<view V>
class chunk_view : public view_interface<chunk_view<V>> {
public:
constexpr outer-iterator begin();
constexpr default_sentinel_t end() noexcept;
};
Even though end()
can be const
-qualified, it is still designed to be non-const
-qualified, which makes end()
's const
-qualification consistent with begin()
's and prevents us from calling as_const(r).end()
.
Do we need to resolve this inconsistency?
Metadata
Metadata
Assignees
Labels
No labels