https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104801
Bug ID: 104801
Summary: std::ranges::view_interface::empty is overconstrained
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: reconnoo at gmail dot com
Target Milestone: ---
I can't see why empty() needs a forward_iterator. It looks overconstrained and
input_iterator should suffice because it is equivalent to the begin/end
iterator comparison, yet, somehow this does not compile:
auto is = std::istringstream{"1 2 3"};
auto v = ranges::istream_view<int>(is);
{
auto is_empty = v.empty(); // error
}
{
auto [begin, end] = std::subrange(v);
auto is_empty = begin == end; // works
}