From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A0C83857C77; Mon, 17 May 2021 03:22:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A0C83857C77 From: "hewillk at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/100631] New: ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator Date: Mon, 17 May 2021 03:22:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hewillk at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2021 03:22:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100631 Bug ID: 100631 Summary: ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- We should add a __distance_from() to elements_view::_Sentinel just like transform_view:: _Sentinel does. https://godbolt.org/z/Ezxh78bv5 #include int main() { auto r =3D std::views::iota(0) | std::views::filter([](int){ return true; }) | std::views::take(42) | std::views::reverse | std::views::transform([](int) { return std::make_pair(42, "hello"); }) | std::views::take(42) | std::views::keys; auto b =3D r.begin(); auto e =3D r.end(); e - b; } :13:8: required from here /opt/compiler-explorer/gcc-trunk-20210513/include/c++/12.0.0/ranges:3689:39: error: 'std::ranges::iterator_t, main():: > > >, main():: > > > std::ranges::elements_view, main():: > > >, main():: > >, 0>::_Iterator::_M_current' is private wit= hin this context 3689 | { return __x._M_end - __y._M_current; } | ~~~~^~~~~~~~~~ /opt/compiler-explorer/gcc-trunk-20210513/include/c++/12.0.0/ranges:3465:29: note: declared private here 3465 | iterator_t<_Base> _M_current =3D iterator_t<_Base>(); | ^~~~~~~~~~=