https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116958
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-10-03 0:00 --- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Avi Kivity from comment #4) > Ah, I see you mention they aren't random access iterators (though maybe they > should be) They satisfy std::random_access_iterator, but do not meet the requirements of a classic STL-style RandomAccessIterator. And the vector(InputIterator, InputIterator) constructor just calls std::distance, which only checks the classic iterator_category. So it treats them as non-RandomAccessIterators. I don't think we can change that, but we can tweak the vector(InputIter, InputIter) constructor to check for std::forward_iterator and use ranges::distance instead, which will work with a larger set of types. Which is Bug 108487.