[Bug libstdc++/122224] std::prev when called with non-bidirectional iterators
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Oct 9 20:16:32 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122224
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
A more compelling argument for it compiling is that something like
views::iota(0,1).begin() returns a Cpp17InputIterator, but it models
std::random_access_iterator so it should be fine to do:
std::prev(std::next(views::iota(0,1).begin()))
and indeed this works correctly with GCC 16.
More information about the Gcc-bugs
mailing list