https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123211
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <[email protected]>: https://gcc.gnu.org/g:15505d012872ddb4c20916c41284e913727b4c80 commit r17-2859-g15505d012872ddb4c20916c41284e913727b4c80 Author: Patrick Palka <[email protected]> Date: Fri Jul 31 14:56:29 2026 -0400 libstdc++: Optimize ranges::distance for segmented iterators [PR123211] For segmented iterators, ranges::distance is equivalent to the sum of ranges::distance of each of its segments. PR libstdc++/123211 libstdc++-v3/ChangeLog: * include/bits/ranges_base.h (__distance_fn::operator()): For the non-sized-sentinel overload, recursively handle segmented iterators via __for_each_segment. Reviewed-by: Jonathan Wakely <[email protected]>
