Talk:cpp/iterator/reverse iterator
From cppreference.com
< Talk:cpp
> std::reverse_iterator
does not work with iterators whose dereference returns a reference to a member of *this
(so-called "stashing iterators").
Why not? Seems fine to me --Ybab321 (talk) 07:49, 10 May 2021 (PDT)
- the stashing iterators are mentioned in lwg2360 which removes support for them as unimplementable without introducing a race or a mutex. I suppose a note could be extended with what actually happens in the implementations (dangling reference that appears to work? data race?) --Cubbi (talk) 12:21, 10 May 2021 (PDT)
error: static_assert failed due to requirement '!__is_stashing_iterator<std::filesystem::path::iterator, void>::value' "The specified iterator type cannot be used with reverse_iterator; Using stashing iterators with reverse_iterator causes undefined behavior"